Support

Account

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);
    }