Custom Fields
Re-Envisioned
Support General On update, custom fields group reverts by itself to standard post type.

  • Creator
    Topic
  • #31159
    Cédric
    Participant

    Hi,

    Using :
    Meta Box V5.4.7
    Meta Box AIO V1.15.1
    Wordpress V5.8.1
    PHP 7.4

    I have a custom fields group attached to a custom post type. At some point, I update my custom fields group to add new fields, and on update, the custom fields group disappears from my custom post.

    Back to the custom fields group, in settings, I can see that the custom fields group changed by itself its location from my_custom_post_type to standard posts.

    If I change location back to my_custom_post_type and update, it is still back by itself to standard post. => impossible to change location to something else than standard post.

    If I generate the php code, the generated code doesn't include the location (ie 'post_types' => ['my_custom_post_type']).

    If I add 'post_types' => ['my_custom_post_type'] to the generated code and insert it in functions.php, then I get my custom fields back on my custom post.

    But it is stil impossible to update my custom fields group to the correct location from the dashboard.

    Can you please help understand what goes wrong and how to fix that ?

    Thanks,

    Cédric

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #31161
    Cédric
    Participant

    Looking at the entry in the database, here is what the meta_value looks like :

    a:4:{s:5:"title";s:20:"Activité - Détails";s:2:"id";s:16:"activite-details";s:4:"tabs";a:6:{s:13:"activite_mots";a:2:{s:5:"label";s:4:"Mots";s:4:"icon";s:0:"";}s:13:"activite-hero";a:2:{s:5:"label";s:5:"Héro";s:4:"icon";s:0:"";}s:12:"activite_cta";a:2:{s:5:"label";s:3:"CTA";s:4:"icon";s:0:"";}.....

    A you can see, the expected post_type value is missing.

    #31171
    Long Nguyen
    Moderator

    Hi Cédric,

    It is possible there is a problem with the post type or the Builder. Please follow the Debugging Information step and let me know how it goes https://metabox.io/support/topic/how-to-create-a-new-topic/.

    Regarding the meta value, it does not save the post type, only the field value. The meta key and value associate with the post by post ID. And you can check the post type in the table wp_posts by post ID.

    #31180
    Cédric
    Participant

    Hi Long,

    Thanks for your answer. Sorry I didn't mention I went through debugging steps before posting. I confirm :
    - all plugins except Meta Box and Metabox AIO were deactivated and the problem is still there.
    - wp debug mode turned on shows no errors.
    - console shows no errors.

    Here is a screencast of my problem

    About the meta value, if I look at other (working properly) field groups, I can see something like :

    a:6:{s:5:"title";s:31:"Témoignages Clients - Détails";s:2:"id";s:25:"temoignages-clients-group";s:10:"post_types";a:1:{i:0;s:19:"temoignages-clients";}s:11:"text_domain";s:16:"your-text-domain";s:13:"function_name";s:25:"your_prefix_function_name";s:6:"fields

    Where I guess this s:10:"post_types"defines the related post types, no ?

    But in the dysfunctioning fields group, the s:10 s:11 s:16 s:13 s:25 elements are missing.

    In the wp_posts table, I can see the post type is meta_box for my fields group, but no reference to the post type associated to my fields group.

    #31181
    Cédric
    Participant

    A few additional information :
    It is still possible to modify existing fields in this group through the builder
    It is not possible to add new fields to this group through the builder

    #31189
    Long Nguyen
    Moderator

    Hi,

    This issue is so weird. Please create a staging site and share the staging credentials via this contact form. I will help you to check this issue.
    https://wordpress.org/plugins/wp-staging/

    #31202
    Cédric
    Participant

    Hi,
    I did create the staging site and sent the credentials via the form.
    Thanks !

    #31223
    Long Nguyen
    Moderator

    Hi,

    Thanks for your sharing.

    I'm not sure what happens with that field group. I've created another field group and assign it to the post-type Activity as well.

    I also exported this field group and import it to my demo site and assign it to a CPT, add more fields without any issue.

    So please try to create a new field group with the same custom fields and assign it to the Activity post type.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.