Ticket #11442: 11442.2.diff
File 11442.2.diff, 1.4 KB (added by , 15 years ago) |
---|
-
wp-includes/functions.php
3511 3511 3512 3512 $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS); 3513 3513 3514 $posts_in_trash = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_status = 'trash'", ARRAY_A); 3515 3516 foreach ( (array) $posts_in_trash as $post ) { 3517 $in_trash[] = $post['ID']; 3518 } 3519 3520 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id NOT IN (%s)", implode( ',', $in_trash ) ) ); 3514 3521 $posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A); 3515 3522 3516 3523 foreach ( (array) $posts_to_delete as $post ) { 3517 3524 wp_delete_post($post['post_id']); 3518 3525 } 3519 3526 3527 $comments_in_trash = $wpdb->get_results("SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = 'trash'", ARRAY_A); 3528 foreach ( (array) $comments_in_trash as $comment ) { 3529 $in_trash[] = $comment['comment_ID']; 3530 } 3531 3532 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (%s)", implode( ',', $in_trash ) ) ); 3520 3533 $comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A); 3521 3534 3522 3535 foreach ( (array) $comments_to_delete as $comment ) {