Make WordPress Core


Ignore:
Timestamp:
10/11/2020 01:37:04 PM (4 years ago)
Author:
johnbillion
Message:

Posts, Post Types: Switch to restoring posts to draft status by default when they are untrashed.

This allows for edits to be made to a restored post before it goes live again. This also prevents scheduled posts being published unexpectedly if they are untrashed after their originally scheduled date.

The old behaviour of restoring untrashed posts to their original status can be reinstated using the wp_untrash_post_set_previous_status() helper function.

Also fixes an issue where the incorrect post ID gets passed to hooks if no post ID is passed to the function.

Props harrym, bananastalktome, jaredcobb, chriscct7, melchoyce, johnbillion, pankajmohale

Fixes #23022

File:
1 edited

Legend:

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

    r48312 r49125  
    292292        }
    293293
    294         wp_redirect( add_query_arg( 'untrashed', 1, $sendback ) );
     294        $sendback = add_query_arg(
     295            array(
     296                'untrashed' => 1,
     297                'ids'       => $post_id,
     298            ),
     299            $sendback
     300        );
     301        wp_redirect( $sendback );
    295302        exit;
    296303
Note: See TracChangeset for help on using the changeset viewer.