From 8b91147c35d9e1ea30fb977eea92a146a9f97627 Mon Sep 17 00:00:00 2001 From: desrosj Date: Thu, 13 Jun 2024 14:46:08 +0000 Subject: [PATCH] Posts/Post Types: Display the correct message when post status is filtered on save. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents the display of an inaccurate message when the `wp_insert_post_data` filter is used to change the status of a post while saving. This bug was only present when using the Classic Editor. The previous code incorrectly assumed that a filter would never change a post’s status to `draft`, resulting in a “Post published.” message instead of “Post draft updated.”. Props freibergergarcia, sirzooro, hakre, blepoxp, scribu, kawauso. Fixes #11207. Built from https://develop.svn.wordpress.org/trunk@58406 git-svn-id: http://core.svn.wordpress.org/trunk@57855 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/post.php | 26 +++++++++++++------------- wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index d6494d53a4..0776b4234f 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -2181,19 +2181,19 @@ function redirect_post( $post_id = '' ) { if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) { $status = get_post_status( $post_id ); - if ( isset( $_POST['publish'] ) ) { - switch ( $status ) { - case 'pending': - $message = 8; - break; - case 'future': - $message = 9; - break; - default: - $message = 6; - } - } else { - $message = 'draft' === $status ? 10 : 1; + switch ( $status ) { + case 'pending': + $message = 8; + break; + case 'future': + $message = 9; + break; + case 'draft': + $message = 10; + break; + default: + $message = isset( $_POST['publish'] ) ? 6 : 1; + break; } $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index d42ccbb15e..18c8778190 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.6-beta2-58405'; +$wp_version = '6.6-beta2-58406'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.