I have a function to run every time a post is published or updated in anyway. Right now I am doing

function myFunction(){
   //Do Something
}    
add_filter('publish_post','myFunction');
add_filter('wp_update_post','myFunction');

Now, when I do this the function is getting called on when I publish a post or make any changes to the Status: Draft/Pending Review (as shown in the attached image), the function is not called. What function to hook to run my function on Status change?

enter image description here

Got it to work. Answer below

1 Answer
1

What I was looking for was transition_post_status. The documentation can be found here.

What I did was to add one more filter add_filter('transition_post_status','myFunction');

Leave a Reply

Your email address will not be published. Required fields are marked *