Support

Account

Home Forums General Issues SAVE_POST action problem

Helping

SAVE_POST action problem

  • I am using a “save_post_cptname” action right now to process data when my CPT is saved.

    However, when a new CPT is created, there is no meta-data. And when a CPT is updated, the changes are not available.

    add_action( 'save_post_events', 'tscpl_pb_save_post', 25, 3);

    I am guessing I need a lower priority (higher number)… but what’s the minimum so that the meta data is there?

  • The problem is that ACF saves values on the “save_post” hook and in\f you look at where this is done, line 3581 of /wp-includes/post.php, you’ll see that the action “save_post_{$post->post_type}” happens before “save_post”.

    You need to use either “acf/save_post” or “save_post” with a priority > 10

    If you want to use this hook then you’d need to look in $_POST[‘acf’] to get the values.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘SAVE_POST action problem’ is closed to new replies.