Skip to content

Commit

Permalink
Move scheduling of old auto-draft posts deletion to `get_default_po…
Browse files Browse the repository at this point in the history
…st_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
  • Loading branch information
azaozz committed Jun 28, 2018
1 parent 679f442 commit 06725cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions wp-admin/includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions wp-admin/post-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@
);
}

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

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 06725cf

Please sign in to comment.