From 5f16c577824831264295f69280efbe27cac97f97 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 2 Nov 2017 19:00:54 +0000 Subject: [PATCH] Customize: Prevent re-importing starter content when changeset is saved as draft or scheduled. Themes cannot currently be switched in Customizer after changeset is saved anyway. Props dlh, westonruter. See #40146, #42411, #42126. Fixes #42395. Built from https://develop.svn.wordpress.org/trunk@42107 git-svn-id: http://core.svn.wordpress.org/trunk@41936 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 14 ++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 12256d2173..4e66070292 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -1175,6 +1175,20 @@ final class WP_Customize_Manager { $changeset_data = array(); if ( $this->changeset_post_id() ) { + /* + * Don't re-import starter content into a changeset saved persistently. + * This will need to be revisited in the future once theme switching + * is allowed with drafted/scheduled changesets, since switching to + * another theme could result in more starter content being applied. + * However, when doing an explicit save it is currently possible for + * nav menus and nav menu items specifically to lose their starter_content + * flags, thus resulting in duplicates being created since they fail + * to get re-used. See #40146. + */ + if ( 'auto-draft' !== get_post_status( $this->changeset_post_id() ) ) { + return; + } + $changeset_data = $this->get_changeset_post_data( $this->changeset_post_id() ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index e4a59c4aaf..1617bc48c2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-RC1-42106'; +$wp_version = '4.9-RC1-42107'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.