Home › Forums › General Issues › acf/save_post question › Reply To: acf/save_post question
In response to the OP. In order to use acf/save_post and tell the difference between a new post and a post that’s being updated, you’ll need some other flag or marker that you can check prior to copying the information from the other post. For example:
function my_acf_save_post($post_id) {
if (get_post_type($post_id) != 'my-post-type') {
return;
}
if (get_post_meta($post_id, 'my-already-copied-flag', true) {
// this one is already done
return;
}
// copy the values you want to copy
// end with updating the flag field
update_post_meta($post_id, 'my-already-copied-flag', 1);
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.