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:

functions.php
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.

  1. Optimization Detective icon Optimization Detective50,000+ installs do_action( 'transition_post_status', $post->post_status, $post->post_status, $post ) detection.php:307
  2. PublishPress Revisions: Duplicate Posts, Submit, Approve and Schedule Content Changes icon 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
  3. Post ID Optimizer icon Post ID Optimizer10+ installs do_action( 'transition_post_status', $new_status, $old_status, $post ) post-poidopt.php:4452
  4. CRAI Content Updater icon 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.