You’ll be able to set ACF date area as Publish revealed date. Lets fbc_sighting_date
is your acf area, then strive following code in your theme features.php
operate change_post_date_to_custom( $post_id ) {
// Get the worth of the customized area
$custom_date = get_field( 'fbc_sighting_date', $post_id );
if ( $custom_date ) {
// Convert the customized date to a timestamp
$timestamp = strtotime( $custom_date );
// Replace the put up's post_date and post_date_gmt fields
$update_post = array(
'ID' => $post_id,
'post_date' => date( 'Y-m-d H:i:s', $timestamp ),
'post_date_gmt' => get_gmt_from_date( date( 'Y-m-d H:i:s', $timestamp ) ),
);
wp_update_post( $update_post );
}
}
add_action( 'save_post', 'change_post_date_to_custom' );