diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 29332b32f..4d3215760 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -42,6 +42,10 @@ nocache_headers(); update_category_cache(); +// Schedule trash collection +if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') ) + wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); + set_screen_options(); $posts_per_page = get_option('posts_per_page'); diff --git a/wp-includes/cron.php b/wp-includes/cron.php index 303c7fc0c..1c2eda0fb 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -393,7 +393,3 @@ function _upgrade_cron_array($cron) { function check_server_timer( $local_time ) { return true; } - -add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); -if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') ) - wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 08cfb7d7c..6def7cc7d 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -203,6 +203,7 @@ add_action( 'future_page', '_future_post_hook', 5, 2 ); add_action( 'save_post', '_save_post_hook', 5, 2 ); add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); +add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); // Post Image CSS class filtering add_action( 'begin_fetch_post_image_html', '_wp_post_image_class_filter_add' );