Make WordPress Core

Changeset 20440


Ignore:
Timestamp:
04/11/2012 08:39:09 PM (12 years ago)
Author:
ryan
Message:

Move deletion of auto-draft posts to the wp_scheduled_delete cron function. Props mgolawala. fixes #19663

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r20308 r20440  
    418418
    419419    if ( $create_in_db ) {
    420         // Cleanup old auto-drafts more than 7 days old
    421         $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
    422         foreach ( (array) $old_posts as $delete )
    423             wp_delete_post( $delete, true ); // Force delete
    424420        $post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) );
    425421        $post = get_post( $post_id );
  • trunk/wp-includes/functions.php

    r20435 r20440  
    33093309/**
    33103310 * Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
     3311 * Deletes auto-drafts for new posts that are > 7 days old
    33113312 *
    33123313 * @since 2.9.0
     
    33503351        }
    33513352    }
     3353
     3354    // Cleanup old auto-drafts more than 7 days old
     3355    $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
     3356    foreach ( (array) $old_posts as $delete )
     3357        wp_delete_post( $delete, true ); // Force delete
    33523358}
    33533359
Note: See TracChangeset for help on using the changeset viewer.