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:
parent
5d499eb3fd
commit
cc3d87bf2b
|
@ -1817,15 +1817,15 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||||
/**
|
/**
|
||||||
* Transition the post status of a post.
|
* Transition the post status of a post.
|
||||||
*
|
*
|
||||||
* Calls hooks to transition post status. If the new post status is not the same
|
* Calls hooks to transition post status.
|
||||||
* 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
|
* The first is 'transition_post_status' with new status, old status, and post data.
|
||||||
* next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
|
*
|
||||||
|
* 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
|
* $new_status parameter and the OLDSTATUS is $old_status parameter; it has the
|
||||||
* post data.
|
* post data.
|
||||||
*
|
*
|
||||||
* The final action will run whether or not the post statuses are the same. The
|
* The final action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
|
||||||
* action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
|
|
||||||
* parameter and POSTTYPE is post_type post data.
|
* parameter and POSTTYPE is post_type post data.
|
||||||
*
|
*
|
||||||
* @since 2.3.0
|
* @since 2.3.0
|
||||||
|
@ -1835,10 +1835,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||||
* @param object $post Post data.
|
* @param object $post Post data.
|
||||||
*/
|
*/
|
||||||
function wp_transition_post_status($new_status, $old_status, $post) {
|
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('transition_post_status', $new_status, $old_status, $post);
|
||||||
do_action("${old_status}_to_$new_status", $post);
|
do_action("${old_status}_to_$new_status", $post);
|
||||||
}
|
|
||||||
do_action("${new_status}_$post->post_type", $post->ID, $post);
|
do_action("${new_status}_$post->post_type", $post->ID, $post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue