From 85b4cddebfb1e001ff3fd2c3e1c9188796719d07 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 5 Feb 2017 06:39:41 +0000 Subject: [PATCH] Customize: Extend auto-draft life of a `customize_changeset` post whenever modified. Keep bumping the date for the auto-draft to preserve it from garbage-collection via `wp_delete_auto_drafts()` after 7 days. See #30937. Fixes #39713. Built from https://develop.svn.wordpress.org/trunk@40041 git-svn-id: http://core.svn.wordpress.org/trunk@39978 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 8 ++++++++ wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 1b2d29dc3b..229a2484ba 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -2494,6 +2494,14 @@ final class WP_Customize_Manager { } elseif ( $args['date_gmt'] ) { $post_array['post_date_gmt'] = $args['date_gmt']; $post_array['post_date'] = get_date_from_gmt( $args['date_gmt'] ); + } elseif ( $changeset_post_id && 'auto-draft' === get_post_status( $changeset_post_id ) ) { + /* + * Keep bumping the date for the auto-draft whenever it is modified; + * this extends its life, preserving it from garbage-collection via + * wp_delete_auto_drafts(). + */ + $post_array['post_date'] = current_time( 'mysql' ); + $post_array['post_date_gmt'] = ''; } $this->store_changeset_revision = $allow_revision; diff --git a/wp-includes/version.php b/wp-includes/version.php index bc0d75115e..cd804f0497 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-40040'; +$wp_version = '4.8-alpha-40041'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.