Is there a way to check in admin page if a post was just updated?

It looks like WP shows a notification so there must be a hook but I can't find it..

enter image description here

I want to trigger some js in the post.php in the admin screen if the post was just updated (post added to database)


The filter you are looking for is save_post. This filter is triggered each time you save a post.

add_action( 'save_post', 'my_function' );
function my_function( $post_id ){
    // Do your stuff here

This filter passes the post's ID to the callback function, so you have access to everything you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.