WordPress action hook · part of WordPress core
transition_post_status
A WordPress core action that 4 plugins also fire themselves, running on 60K+ sites between them.
“This action is documented in wp-includes/post.php.”
How to use transition_post_status
It's an action: your callback runs at that point and receives 3 arguments. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'transition_post_status', function( $post_status, $post_status2, $post ) {
// Your code runs here.
}, 10, 3 );Argument names come from Optimization Detective's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
4 plugins that fire transition_post_status
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Optimization Detective50,000+ installs
do_action( 'transition_post_status', $post->post_status, $post->post_status, $post )detection.php:307 -
PublishPress Revisions: Duplicate Posts, Submit, Approve and Schedule Content Changes10,000+ installs
do_action( 'transition_post_status', $published->post_status, $old_status, $_published )admin/revision-action_rvy.php:1303 -
Post ID Optimizer10+ installs
do_action( 'transition_post_status', $new_status, $old_status, $post )post-poidopt.php:4452 -
CRAI Content UpdaterFewer than 10 installs
do_action( 'transition_post_status', 'publish', 'publish', $updated_post )includes/class-crai-updater.php:1369
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.