Always do post status transition actions. Props nbachiyski. fixes #8792

git-svn-id: http://svn.automattic.com/wordpress/trunk@11197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-05-05 05:53:55 +00:00
parent 5d499eb3fd
commit cc3d87bf2b
1 changed files with 8 additions and 10 deletions

View File

@ -1817,15 +1817,15 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
/**
* Transition the post status of a post.
*
* Calls hooks to transition post status. If the new post status is not the same
* as the previous post status, then two hooks will be ran, the first is
* 'transition_post_status' with new status, old status, and post data. The
* next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
* Calls hooks to transition post status.
*
* The first is 'transition_post_status' with new status, old status, and post data.
*
* The next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
* $new_status parameter and the OLDSTATUS is $old_status parameter; it has the
* post data.
*
* The final action will run whether or not the post statuses are the same. The
* action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
* The final action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
* parameter and POSTTYPE is post_type post data.
*
* @since 2.3.0
@ -1835,10 +1835,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
* @param object $post Post data.
*/
function wp_transition_post_status($new_status, $old_status, $post) {
if ( $new_status != $old_status ) {
do_action('transition_post_status', $new_status, $old_status, $post);
do_action("${old_status}_to_$new_status", $post);
}
do_action("${new_status}_$post->post_type", $post->ID, $post);
}