Move scheduling of old auto-draft posts deletion to get_default_post_to_edit() (where auto-drafts are created).

Fixes #44337.
Built from https://develop.svn.wordpress.org/trunk@43338


git-svn-id: http://core.svn.wordpress.org/trunk@43166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2018-06-28 02:26:22 +00:00
parent 679f442285
commit 06725cf28d
3 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -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;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-43337';
$wp_version = '5.0-alpha-43338';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.