ACF Field to set Publish Date – Post Duplication upon Update

Drew, one thing about your code above is that the word dateAllergy should be in quotation marks like. I’m not sure of that is the problem but it’s worth changing.

 $datefield = get_post_meta($post_id, 'dateAllergy' ,true);

Also, I just noticed that your $post_id variable will be empty too. You should change that to $post->ID. That would explain why duplicate posts are being created because it the value is null or empty, WordPress will create a separate post