Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: {$old_status}_to_{$new_status}

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
5017       * Fires when a post is transitioned from one status to another.
5018       *
5019       * The dynamic portions of the hook name, `$new_status` and `$old_status`,
5020       * refer to the old and new post statuses, respectively.
5021       *
5022       * @since 2.3.0
5023       *
5024       * @param WP_Post $post Post object.
5025       */
5026      do_action( "{$old_status}_to_{$new_status}", $post );
5027
5028      /**
5029       * Fires when a post is transitioned from one status to another.
5030       *
5031       * The dynamic portions of the hook name, `$new_status` and `$post->post_type`,
5032       * refer to the new post status and post type, respectively.
5033       *
5034       * Please note: When this action is hooked using a particular post status (like
5035       * 'publish', as `publish_{$post->post_type}`), it will fire both when a post is