Home Forums Bug Reports acf/save_post does nothing


acf/save_post does nothing

  • Not sure if I should open a ticket for this yet or not.

    According to the documentation, “This action allows you to hook in before or after the $_POST data has been saved, making it useful to perform additional functionality when updating a post or other WP object.”

    That’s exactly what I wan to do. Problem is, it does nothing. It’s never executed.

    add_action('acf/save_post', 'my_acf_save_post');
    function my_acf_save_post( $post_id ) {
    	file_put_contents('vardump.txt', serialize($post_id));

    Nothing is ever written to my dump file.

    Using the standard WP “save_post” action hook, the ID is written to my dump file:

    add_action('save_post', 'my_wp_save_post');
    function my_wp_save_post( $post_id ) {
    	file_put_contents('vardump.txt', serialize($post_id));

    No errors and nothing in debug log. The “acf/save_post” action hook just does nothing.

    I’d like to do additional processing on $_POST data prior to saving to the DB, but I can’t even get it to write the post_id right now.

    Should I report this as an official bug, or am I the only one experiencing this bizarre issue?

  • There are conditions where the hook will not fire.

    If no ACF fields are present in the submission.

    I have also noticed that the hook might not be fired if no edits are made to ACF fields.

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

You must be logged in to reply to this topic.