Support

Account

Home Forums Backend Issues (wp-admin) add_post_meta and datepicker field

Helping

add_post_meta and datepicker field

  • Hi all!
    I’ve recently faced this problem with ACF: I’m trying to setup some default values in ACF fields with this code:

    function set_default_custom_fields($post_id){
    if ( $_GET[‘post_type’] == ‘orders’ ) {
    add_post_meta($post_id, ‘nation’, ‘my default nation’);
    add_post_meta($post_id, ‘address’, ‘my default address’);
    }
    return true;
    }

    add_action(‘wp_insert_post’, ‘set_default_custom_fields’);

    everything seems to work right if the fields are Text Type fields… If I try the same thing with a datepicker field it won’t initialized with the default value (also if the default value is a date in the correct format!)
    Can you help me?

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘add_post_meta and datepicker field’ is closed to new replies.