Home › Forums › Backend Issues (wp-admin) › Create Multiple Posts on Back End › Reply To: Create Multiple Posts on Back End
Hi @karks88
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.
Thanks!
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.