• Resolved fusan

    (@fusan1)


    add_action( 'save_post', 'fires_on_save', 10, 3 );
     
    function fires_on_save( $post_id, $post, $update ) {
        do_action( 'qm/debug', 'Save happened!' );
    }

    or

    add_action( 'save_post_post', 'fires_on_save', 10, 3 );
     
    function fires_on_save( $post_id, $post, $update ) {
        do_action( 'qm/debug', 'Save happened!' );
    }

    These codes are only firing when I create a post. After that no matter how much modification and save I do it won’t fire again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    “save_post” should fire on updates. Could your added action callback to “qm/debug” be added too late or not at all for some reason? Try replacing the do_action() call with error_log('save_post action has fired!');. Do an update, then check your error log.

    Thread Starter fusan

    (@fusan1)

    @bcworkz Thanks for that. I guess something was wrong with that “Query monitor” plugin. I was using that for debugging. Everything is working properly with the native WordPress debugging.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘save_post firing only once on post creation’ is closed to new replies.