WordPress.org

Make WordPress Core

Ticket #8792: transitions-to-same-status.diff

File transitions-to-same-status.diff, 1.6 KB (added by nbachiyski, 9 years ago)
  • wp-includes/post.php

     
    17711771/**
    17721772 * Transition the post status of a post.
    17731773 *
    1774  * Calls hooks to transition post status. If the new post status is not the same
    1775  * as the previous post status, then two hooks will be ran, the first is
    1776  * 'transition_post_status' with new status, old status, and post data. The
    1777  * next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
     1774 * Calls hooks to transition post status.
     1775 *
     1776 * The first is 'transition_post_status' with new status, old status, and post data.
     1777 *
     1778 * The next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
    17781779 * $new_status parameter and the OLDSTATUS is $old_status parameter; it has the
    17791780 * post data.
    17801781 *
    1781  * The final action will run whether or not the post statuses are the same. The
    1782  * action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
     1782 * The final action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
    17831783 * parameter and POSTTYPE is post_type post data.
    17841784 *
    17851785 * @since 2.3.0
     
    17891789 * @param object $post Post data.
    17901790 */
    17911791function wp_transition_post_status($new_status, $old_status, $post) {
    1792         if ( $new_status != $old_status ) {
    1793                 do_action('transition_post_status', $new_status, $old_status, $post);
    1794                 do_action("${old_status}_to_$new_status", $post);
    1795         }
     1792        do_action('transition_post_status', $new_status, $old_status, $post);
     1793        do_action("${old_status}_to_$new_status", $post);
    17961794        do_action("${new_status}_$post->post_type", $post->ID, $post);
    17971795}
    17981796