Ticket #11442: 11442.diff
File 11442.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_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' ANDmeta_value < '%d'", $delete_timestamp), ARRAY_A);3514 $posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT m.post_id FROM $wpdb->postmeta AS m, $wpdb->posts AS p WHERE p.ID = m.post_id AND p.post_status = 'trash' AND m.meta_key = '_wp_trash_meta_time' AND m.meta_value < '%d'", $delete_timestamp), ARRAY_A); 3515 3515 3516 3516 foreach ( (array) $posts_to_delete as $post ) { 3517 3517 wp_delete_post($post['post_id']); 3518 3518 } 3519 3519 3520 $comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' ANDmeta_value < '%d'", $delete_timestamp), ARRAY_A);3520 $comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT m.comment_id FROM $wpdb->commentmeta AS m, $wpdb->comments AS c WHERE c.comment_ID = m.comment_id AND c.comment_approved = 'trash' AND m.meta_key = '_wp_trash_meta_time' AND m.meta_value < '%d'", $delete_timestamp), ARRAY_A); 3521 3521 3522 3522 foreach ( (array) $comments_to_delete as $comment ) { 3523 3523 wp_delete_comment($comment['comment_id']);