Make WordPress Core


Ignore:
Timestamp:
07/30/2009 02:55:07 PM (17 years ago)
Author:
azaozz
Message:

Trash status update, see #4529

File:
1 edited

Legend:

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

    r11749 r11750  
    12501250
    12511251/**
    1252  * Removes a post or page from the Trash
     1252 * Restores a post or page from the Trash
    12531253 *
    12541254 * @since 2.9.0
     
    12601260 */
    12611261function wp_untrash_post($postid = 0) {
    1262         if (!$post = wp_get_single_post($postid, ARRAY_A))
     1262        if ( !$post = wp_get_single_post($postid, ARRAY_A) )
    12631263                return $post;
    12641264
    12651265        do_action('untrash_post', $postid);
    1266        
     1266
    12671267        $post['post_status'] = 'draft';
    1268        
     1268
    12691269        $trash_meta = get_option('wp_trash_meta');
    1270         if (is_array($trash_meta) && isset($trash_meta['posts'][$postid])) {
     1270        if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) {
    12711271                $post['post_status'] = $trash_meta['posts'][$postid]['status'];
    12721272                unset($trash_meta['posts'][$postid]);
    12731273                update_option('wp_trash_meta', $trash_meta);
    12741274        }
    1275        
     1275
    12761276        wp_insert_post($post);
    1277        
     1277
    12781278        do_action('untrashed_post', $postid);
    12791279
     
    26632663        if ( 'attachment' != $post->post_type )
    26642664                return false;
    2665        
     2665
    26662666        if ( 'trash' != $post->post_status )
    26672667                return wp_trash_post($postid);
Note: See TracChangeset for help on using the changeset viewer.