diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index 392fea93e0..bb90aff606 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -647,6 +647,11 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) { set_post_format( $post, get_option( 'default_post_format' ) ); } + + // Schedule auto-draft cleanup + if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { + wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); + } } else { $post = new stdClass; $post->ID = 0; diff --git a/src/wp-admin/post-new.php b/src/wp-admin/post-new.php index da7e08cada..abd0baf33a 100644 --- a/src/wp-admin/post-new.php +++ b/src/wp-admin/post-new.php @@ -63,11 +63,6 @@ if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_ ); } -// Schedule auto-draft cleanup -if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { - wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); -} - $post = get_default_post_to_edit( $post_type, true ); $post_ID = $post->ID;