Default field is not working

Support MB Builder Default field is not workingResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4179
    piretruspiretrus
    Participant

    `The default value is not working. When the metaboxes charge in the post, the value of the fields with default value are blank, don't return anything, until write or select something.

    #4188
    piretruspiretrus
    Participant

    If the post is new, all the default values loads correctly, but if is old not.

    #4189
    piretruspiretrus
    Participant

    It's my code:

    https://ghostbin.com/paste/g6uwn

    #4218
    Anh TranAnh Tran
    Keymaster

    For old posts, the custom fields already have some value (even empty values). So it doesn't make any sense to set the default value anymore.

    #4245
    piretruspiretrus
    Participant

    It's possible force to recover the default values from metabox?

    We have 5 metabox configurations, and by default witch type of post have a metabox. The idea is that all the custom psot type with name XX have the same default values from his metabox.

    It will be possible to force that and old post come back to the defaults values?

    #4260
    Anh TranAnh Tran
    Keymaster

    If you just want to revert the default value for the old post, you can just run this code:

    $post_id = 123; // Your post ID
    $field_id = 'abc'; // The field ID
    $default = 'some thing'; // Default value
    update_post_meta( $post_id, $field_id, $default );

    Put it in a functionality plugin and run it once.

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