Make WordPress Core


Ignore:
Timestamp:
05/05/2009 05:53:55 AM (16 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r11125 r11197  
    18181818 * Transition the post status of a post.
    18191819 *
    1820  * Calls hooks to transition post status. If the new post status is not the same
    1821  * as the previous post status, then two hooks will be ran, the first is
    1822  * 'transition_post_status' with new status, old status, and post data. The
    1823  * next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
     1820 * Calls hooks to transition post status.
     1821 *
     1822 * The first is 'transition_post_status' with new status, old status, and post data.
     1823 *
     1824 * The next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
    18241825 * $new_status parameter and the OLDSTATUS is $old_status parameter; it has the
    18251826 * post data.
    18261827 *
    1827  * The final action will run whether or not the post statuses are the same. The
    1828  * action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
     1828 * The final action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
    18291829 * parameter and POSTTYPE is post_type post data.
    18301830 *
     
    18361836 */
    18371837function wp_transition_post_status($new_status, $old_status, $post) {
    1838     if ( $new_status != $old_status ) {
    1839         do_action('transition_post_status', $new_status, $old_status, $post);
    1840         do_action("${old_status}_to_$new_status", $post);
    1841     }
     1838    do_action('transition_post_status', $new_status, $old_status, $post);
     1839    do_action("${old_status}_to_$new_status", $post);
    18421840    do_action("${new_status}_$post->post_type", $post->ID, $post);
    18431841}
Note: See TracChangeset for help on using the changeset viewer.