Posts/Post Types: Display the correct message when post status is filtered on save.
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
This commit is contained in:
parent
4d68eaaa45
commit
8b91147c35
|
@ -2181,7 +2181,6 @@ 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;
|
||||
|
@ -2189,11 +2188,12 @@ function redirect_post( $post_id = '' ) {
|
|||
case 'future':
|
||||
$message = 9;
|
||||
break;
|
||||
case 'draft':
|
||||
$message = 10;
|
||||
break;
|
||||
default:
|
||||
$message = 6;
|
||||
}
|
||||
} else {
|
||||
$message = 'draft' === $status ? 10 : 1;
|
||||
$message = isset( $_POST['publish'] ) ? 6 : 1;
|
||||
break;
|
||||
}
|
||||
|
||||
$location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue