Make WordPress Core

Changeset 58406

Timestamp:
06/13/2024 02:44:45 PM (8 weeks ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r58360 r58406  
    21822182        $status = get_post_status( $post_id );
    21832183
    2184         if ( isset( $_POST['publish'] ) ) {
    2185             switch ( $status ) {
    2186                 case 'pending':
    2187                     $message = 8;
    2188                     break;
    2189                 case 'future':
    2190                     $message = 9;
    2191                     break;
    2192                 default:
    2193                     $message = 6;
    2194             }
    2195         } else {
    2196             $message = 'draft' === $status ? 10 : 1;
     2184        ) {
     2185           
     2186               
     2187                ;
     2188           
     2189               
     2190                ;
     2191           
     2192               
     2193                ;
     2194           
     2195       
     2196            ;
    21972197        }
    21982198
Note: See TracChangeset for help on using the changeset viewer.