Make WordPress Core

Ticket #36180: 36180.1.diff

File 36180.1.diff, 811 bytes (added by audrasjb, 4 years ago)

Posts, Post Types: Add $old_status parameter to {$new_status}_{$post->post_type} action

  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 2487e5b4c2..4d07fecaf6 100644
    a b function wp_transition_post_status( $new_status, $old_status, $post ) { 
    51565156         * transitioned to a status, use the {@see 'transition_post_status'} hook instead.
    51575157         *
    51585158         * @since 2.3.0
     5159         * @since 5.9.0 The `$old_status` parameter was added.
    51595160         *
    5160          * @param int     $post_id Post ID.
    5161          * @param WP_Post $post    Post object.
     5161         * @param int     $post_id    Post ID.
     5162         * @param WP_Post $post       Post object.
     5163         * @param string  $old_status Old post status.
    51625164         */
    5163         do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
     5165        do_action( "{$new_status}_{$post->post_type}", $post->ID, $post, $old_status );
    51645166}
    51655167
    51665168/**