mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Schedule auto-draft deletion from post-new.php instead of from admin.php. This provides better throttling for large multisite installs and reduces the risk of a delete avalanche.
fixes #19663 git-svn-id: https://develop.svn.wordpress.org/trunk@20453 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -5163,6 +5163,20 @@ function get_post_format_link( $format ) {
|
||||
return get_term_link( $term );
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes auto-drafts for new posts that are > 7 days old
|
||||
*
|
||||
* @since 3.4.0
|
||||
*/
|
||||
function wp_delete_auto_drafts() {
|
||||
global $wpdb;
|
||||
|
||||
// Cleanup old auto-drafts more than 7 days old
|
||||
$old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
|
||||
foreach ( (array) $old_posts as $delete )
|
||||
wp_delete_post( $delete, true ); // Force delete
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the request to allow for the format prefix.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user