WordPress.org

Make WordPress Core

Ticket #23022: alwaysdraft.diff

File alwaysdraft.diff, 533 bytes (added by harrym, 2 years ago)

Sets untrashed posts to draft status instead of their original status

  • wp-includes/post.php

    diff --git a/wp-includes/post.php b/wp-includes/post.php
    index 54f17f4..6b4aa26 100644
    a b function wp_untrash_post($post_id = 0) { 
    24382438 
    24392439        do_action('untrash_post', $post_id); 
    24402440 
    2441         $post_status = get_post_meta($post_id, '_wp_trash_meta_status', true); 
     2441        $post['post_status'] = 'draft'; 
    24422442 
    2443         $post['post_status'] = $post_status; 
    2444  
    2445         delete_post_meta($post_id, '_wp_trash_meta_status'); 
    24462443        delete_post_meta($post_id, '_wp_trash_meta_time'); 
    24472444 
    24482445        wp_insert_post($post);