WordPress.org

Make WordPress Core

Ticket #38899: 38899.1.diff

File 38899.1.diff, 2.4 KB (added by westonruter, 3 years ago)
  • src/wp-admin/admin.php

    diff --git src/wp-admin/admin.php src/wp-admin/admin.php
    index 2dd315d..d456bac 100644
    require_once(ABSPATH . 'wp-admin/includes/admin.php'); 
    8383
    8484auth_redirect();
    8585
    86 // Schedule trash collection
    87 if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() )
    88         wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
    89 
    9086set_screen_options();
    9187
    9288$date_format = __( 'F j, Y' );
  • src/wp-admin/post-new.php

    diff --git src/wp-admin/post-new.php src/wp-admin/post-new.php
    index ac80f13..01025ab 100644
    if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_ 
    6262        );
    6363}
    6464
    65 // Schedule auto-draft cleanup
    66 if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
    67         wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
    68 
    6965wp_enqueue_script( 'autosave' );
    7066
    7167if ( is_multisite() ) {
  • src/wp-includes/default-filters.php

    diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
    index 5a73975..3a7a2a9 100644
    add_action( 'rss2_head', 'rss2_site_icon' ); 
    285285// WP Cron
    286286if ( !defined( 'DOING_CRON' ) )
    287287        add_action( 'init', 'wp_cron' );
     288add_action( 'init', 'wp_schedule_garbage_collection' );
    288289
    289290// 2 Actions 2 Furious
    290291add_action( 'do_feed_rdf',                'do_feed_rdf',                             10, 1 );
  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index 8593e8c..ad7f302 100644
    function _cleanup_header_comment( $str ) { 
    46634663}
    46644664
    46654665/**
     4666 * Schedule events for garbage collection.
     4667 *
     4668 * Ensure that trashed posts and auto-drafts get garbage-collected by WP Cron.
     4669 *
     4670 * @since 4.7.0
     4671 */
     4672function wp_schedule_garbage_collection() {
     4673        if ( wp_installing() ) {
     4674                return;
     4675        }
     4676
     4677        // Ensure that auto-draft posts will get garbage-collected.
     4678        if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) {
     4679                wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
     4680        }
     4681
     4682        // Schedule trash collection.
     4683        if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) ) {
     4684                wp_schedule_event( time(), 'daily', 'wp_scheduled_delete' );
     4685        }
     4686}
     4687
     4688/**
    46664689 * Permanently delete comments or posts of any type that have held a status
    46674690 * of 'trash' for the number of days defined in EMPTY_TRASH_DAYS.
    46684691 *