Home › Forums › Backend Issues (wp-admin) › Create Multiple Posts on Back End › Reply To: Create Multiple Posts on Back End
I think the ‘acf/save_post’ is executed when you use the wp_insert_post() function, so you get the infinite/double post issue. Could you please modify it like the following?
// remove action to avoid infinite loop issue remove_action('acf/save_post', 'my_acf_save_multiple_posts', 20); // post it! $new_post_id = wp_insert_post($new_post); // add the action back add_action('acf/save_post', 'my_acf_save_multiple_posts', 20);
This page should give you more idea about it: https://codex.wordpress.org/Function_Reference/wp_update_post#Caution_-_Infinite_loop.
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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.