Changeset 11878 for trunk/wp-includes/functions.php
- Timestamp:
- 08/25/2009 10:05:15 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r11750 r11878 3347 3347 */ 3348 3348 function wp_scheduled_delete() { 3349 global $wpdb; 3350 3351 $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS); 3352 3353 $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); 3354 3355 foreach ( (array) $posts_to_delete as $post ) { 3356 wp_delete_post($post['post_id']); 3357 } 3358 3359 //Trashed Comments 3360 //TODO Come up with a better store for the comment trash meta. 3349 3361 $trash_meta = get_option('wp_trash_meta'); 3350 3362 if ( !is_array($trash_meta) ) 3351 3363 return; 3352 3353 $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);3354 3364 3355 3365 foreach ( (array) $trash_meta['comments'] as $id => $meta ) { … … 3359 3369 } 3360 3370 } 3361 foreach ( (array) $trash_meta['posts'] as $id => $meta ) {3362 if ( $meta['time'] < $delete_timestamp ) {3363 wp_delete_post($id);3364 unset($trash_meta['posts'][$id]);3365 }3366 }3367 3371 3368 3372 update_option('wp_trash_meta', $trash_meta); 3369 3373 } 3374 ?>
Note: See TracChangeset
for help on using the changeset viewer.