Support

Account

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);