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?