WordPress.org

Make WordPress Core

Ticket #11442: 11442.4.diff

File 11442.4.diff, 1.2 KB (added by caesarsgrunt, 8 years ago)
  • wp-includes/comment.php

     
    898898                $status = '0';
    899899
    900900        if ( wp_set_comment_status($comment_id, $status) ) {
    901                 delete_comment_meta($comment_id, '_wp_trash_meta_time');
    902                 delete_comment_meta($comment_id, '_wp_trash_meta_status');
    903901                do_action('untrashed_comment', $comment_id);
    904902                return true;
    905903        }
     
    953951                $status = '0';
    954952
    955953        if ( wp_set_comment_status($comment_id, $status) ) {
    956                 delete_comment_meta($comment_id, '_wp_trash_meta_status');
    957954                do_action('unspammed_comment', $comment_id);
    958955                return true;
    959956        }
     
    12621259        }
    12631260
    12641261        $comment_old = wp_clone(get_comment($comment_id));
     1262        $old_status = $comment_old->comment_approved;
     1263       
     1264        if ( !in_array( $status, array('trash','spam') ) && in_array( $old_status, array('trash','spam') ) ) {
     1265                delete_comment_meta($comment_id, '_wp_trash_meta_time');
     1266                delete_comment_meta($comment_id, '_wp_trash_meta_status');
     1267        }
    12651268
    12661269        if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) {
    12671270                if ( $wp_error )