Ticket #8792: transitions-to-same-status.diff
| File transitions-to-same-status.diff, 1.6 KB (added by nbachiyski, 3 years ago) |
|---|
-
wp-includes/post.php
1771 1771 /** 1772 1772 * Transition the post status of a post. 1773 1773 * 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 1778 1779 * $new_status parameter and the OLDSTATUS is $old_status parameter; it has the 1779 1780 * post data. 1780 1781 * 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 1783 1783 * parameter and POSTTYPE is post_type post data. 1784 1784 * 1785 1785 * @since 2.3.0 … … 1789 1789 * @param object $post Post data. 1790 1790 */ 1791 1791 function 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); 1796 1794 do_action("${new_status}_$post->post_type", $post->ID, $post); 1797 1795 } 1798 1796
