WordPress.org

Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #38899


Ignore:
Timestamp:
11/22/2016 04:06:10 AM (3 years ago)
Author:
westonruter
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #38899

    • Property Owner set to westonruter
    • Property Status changed from new to accepted
    • Property Component changed from Customize to REST API
    • Property Summary changed from Customize: Ensure auto-draft deletion gets scheduled to Deletion of auto-drafts and trashed posts never gets scheduled unless user accesses admin pages
  • Ticket #38899 – Description

    initial v2  
    1111
    1212This logic should be added to `WP_Customize_Manager` as well so that these starter content auto-draft posts will get garbage collected (as well as the unpublished `customize_changeset` posts themselves) will get garbage-collected in the rare case where a user never goes to `post-new.php` on a given install. A user never visiting `post-new.php` is entirely possible if the user does all of their site management in the customizer or via the REST API.
     13
     14What's more is that the scheduling of trash deletion is also dependent on the user first accessing the admin, as `wp-admin/admin.php` contains:
     15
     16{{{#!php
     17<?php
     18// Schedule trash collection
     19if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() )
     20        wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
     21}}}
     22
     23So as such, this is also a concern for purely headless WP installs that make use of the REST API exclusively. If a site gets installed headlessly (e.g. via WP-CLI) and the admin is never accessed, then neither trashed posts nor auto-draft posts will never get deleted because they are never scheduled.