From dc3c350eab64b80537972f25f33654b5cec33bb0 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 2 Nov 2017 18:59:40 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@42107 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-customize-manager.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 12256d2173..4e66070292 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/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() ); }