Wrong search terms, already found it:
function on_all_status_transitions( $new_status, $old_status, $post ) {
if ( $new_status != $old_status ) {
// A function to perform actions any time any post changes status.
}
}
add_action( 'transition_post_status', 'on_all_status_transitions', 10, 3 );
Related Posts:
- Is there a action hook for the “Empty Trash” button?
- Function to execute when a post is moved to trash .
- add action only on post publish – not update
- How to Display a List of Users Who Have Made at Least 1 Post?
- How to validate XML-RPC post creation and cancel when needed?
- Let private posts stay in status “private” after edit through “editors”
- Create posts on user registration
- How to publish a post with empty title and empty content?
- How to add a “publish” link to the quick actions
- Action hook ‘wp’ firing twice… why?
- Count singular post views automatically
- featuring old articles without messing up with the archive
- Setting post meta data to random value during post status transition / on publish
- How to change post status from publish to draft using hook in wordpress?
- Hiding by default specific post status on backend list?
- Enable commenting on front-end preview page for pending posts
- Get the post_id of a new post
- Custom function for “Submit for Review” hook
- Custom Post Status Posts viewable to the public
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?
- How can a guest view the “Pending Review” Post?
- How do I batch create revisions of all posts?
- add filter to “quick edit menu” in wordpress admin
- ‘transition_post_status’ only fires when pressing “Add New”
- add_action not using ‘delete_post’ action with wp_delete_post
- the_posts filter been called multiple time
- Get post id in wordpress action?
- How can i do something after head like adding a hook for after head but before post
- What differences are there between a Privately Published post and a Draft post?
- How to run a function when post is edited or updated using publish post action?
- Create cron job without a plugin?
- How to generate numbers indistinguishable for the IDs of the posts
- Update post status from “publish” to “trash” for half of posts
- How can I set a Post’s default visibility to private and pending review checked
- how to remove dash (-) post status from post title on posts listing page wordpress
- How to change post status from frontend?
- Adding custom fields to bbpress reply form
- Adding buttons to Add New Post and Add New Page
- How to access $post from a callback function
- Posts and Attachments with “Published” status in Search
- Admin – create custom post status and display above table
- Restrict edit, but allow preview for custom post status
- WordPress capabilities on pending post status
- Set static page/post from another blog on same network
- Copy post to separate database with “add_action(….)”
- Call Web Services on post first publish
- How to check if single.php has already called the_post_thumbnail function
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- $post->post_type not working
- how can i allow users to view their own pending posts in a front-end page
- What does WordPress do if I save a post without content/title? [duplicate]
- Divs appearing everywhere in post content
- Prevent posts with certain post_meta to be edited
- How to check in functions.php if there is data in a WP_Query?
- Update post meta within save_post action
- Automatically set post_parent value
- Is there a way getting post fields using `transition_post_status`
- What function publishes a post when you click the publish button?
- Exists filter or action that change Add New Post link?
- Post Status Frontend Announcement
- Display amount of pending posts in back/front end
- Showing posts for today and future
- Actions to use when flushing cache (when posts are added / deleted / modified)
- Show Last Revision Of Post That Has A Published Status On Single Page
- How can I restore posts from ‘trash’ with their previous post_status? – WordPress
- Is there a way to know when a page has been updated and do some action only once?
- How to set a Post’s default visibility to ‘Private’ in Gutenberg?
- Run a function when a custom post is update?
- the wp_post_update isn’t working all the time
- Updating post status via rest api
- Send email to user when I publish a new post
- Is update_post_meta used when save_post action hook is invoked?
- Count singular post views automatically
- How publish post from pending status
- Hide or remove custom post status
- Put page on Archived statut after end of publication date
- get_next_post() not working with future post status
- How can i take all ids from untrash_post action?
- Grab meta data before post is saved
- Modify loop to include all post statuses not just ‘published’
- Is it possible to completely replace a post with an action/filter?
- Hook To Get All Posts Deleted
- Function/filter or plugin to change post status based on custom field value
- get_posts includes “auto drafts”?
- I am creating a front end dashboard where I need to show all the posts by the current user. So, I need to show posts in publish
- Action while post is being published
- Post Format Status [closed]
- editPost without undo entry
- Modify upload directory to use post category slug in file path on multisite installation
- REST API – Retrieving posts with custom status
- Implementing Soft Delete for Bulk Actions / Empty Trash
- How to restore post to pending status (no draft)
- How to add publish button in menu All Posts (Wp-Admin)
- Get WordPress post content by post id
- Get page ID of page that is set as the posts page
- Get Posts Under Custom Taxonomy
- How to limit the number of posts that WP_Query gets?
- Stop WordPress Wrapping Images In A “P” Tag
- When is the ‘post_content_filtered’ column in database cleared by WordPress?