WordPress.org

Make WordPress Core

Ticket #11209: 11209.diff

File 11209.diff, 654 bytes (added by caesarsgrunt, 8 years ago)

Empty trash as soon as EMPTY_TRASH_DAYS is set to 0

  • wp-admin/admin.php

     
    4343update_category_cache();
    4444
    4545// Schedule trash collection
    46 if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') )
     46if ( !wp_next_scheduled('wp_scheduled_delete') && EMPTY_TRASH_DAYS && !defined('WP_INSTALLING') )
    4747        wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
     48elseif ( !EMPTY_TRASH_DAYS && !defined('WP_INSTALLING') ) {
     49        wp_clear_scheduled_hook('wp_scheduled_delete');
     50        wp_scheduled_delete();
     51}
    4852
    4953set_screen_options();
    5054