Move scheduling of old auto-draft
posts deletion to get_default_post_to_edit()
(where auto-drafts are created).
Fixes #44337. git-svn-id: https://develop.svn.wordpress.org/trunk@43338 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2325faeb96
commit
d3014a47b4
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user