Support

Account

Home Forums ACF PRO Auto populate new posts by submitting a different post type Reply To: Auto populate new posts by submitting a different post type

  • Create an acf/save_post filter that runs after acf http://www.advancedcustomfields.com/resources/acfsave_post/

    Be sure to check the post type of the post just saved to prevent an infinite loop.

    
    add_action('acf/save_post', 'create_payslip');
    function create_payslip($post_id) {
      if (get_post_type($post_id) != 'timesheet') {
        return;
      }
      // get values from $post_id
      // use wp_insert_post() to create new post
      // use update_field() to update any acf fields
    }