WordPress.org

Make WordPress Core

Changeset 12412


Ignore:
Timestamp:
12/16/09 01:35:29 (4 years ago)
Author:
azaozz
Message:

Check post and comment status before emptying trash, fixes #11442

File:
1 edited

Legend:

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

    r12405 r12412  
    35193519 
    35203520    foreach ( (array) $posts_to_delete as $post ) { 
    3521         wp_delete_post($post['post_id']); 
     3521        $post_id = (int) $post['post_id']; 
     3522        if ( !$post_id ) 
     3523            continue; 
     3524 
     3525        $del_post = get_post($post_id); 
     3526 
     3527        if ( !$del_post || 'trash' != $del_post->post_status ) { 
     3528            delete_post_meta($post_id, '_wp_trash_meta_status'); 
     3529            delete_post_meta($post_id, '_wp_trash_meta_time'); 
     3530        } else { 
     3531            wp_delete_post($post_id); 
     3532        } 
    35223533    } 
    35233534 
     
    35253536 
    35263537    foreach ( (array) $comments_to_delete as $comment ) { 
    3527         wp_delete_comment($comment['comment_id']); 
     3538        $comment_id = (int) $comment['comment_id']; 
     3539        if ( !$comment_id ) 
     3540            continue; 
     3541 
     3542        $del_comment = get_comment($comment_id); 
     3543 
     3544        if ( !$del_comment || 'trash' != $del_comment->comment_approved ) { 
     3545            delete_comment_meta($comment_id, '_wp_trash_meta_time'); 
     3546            delete_comment_meta($comment_id, '_wp_trash_meta_status'); 
     3547        } else { 
     3548            wp_delete_comment($comment_id); 
     3549        } 
    35283550    } 
    35293551} 
Note: See TracChangeset for help on using the changeset viewer.