Home › Forums › ACF PRO › Update value function causes timeout › Reply To: Update value function causes timeout
Aha! The answer lies here: http://codex.wordpress.org/Plugin_API/Action_Reference/save_post#Avoiding_infinite_loops
Essentially I was creating an infinite loop of updating the value <–> updating the post. Not sure why this suddenly started happening (where it was working fine before), perhaps a WP or ACF change means that the update_value filter is getting triggered by wp_update_post where it wasn’t before.
Anyway, simple solution is:
remove_filter('acf/update_value/name=author', 'author_acf_update_value', 10);
wp_update_post(array('ID' => $post_id,'post_author' => $value));
add_filter('acf/update_value/name=author', 'author_acf_update_value', 10, 3);
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.