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
This commit is contained in:
Weston Ruter 2017-11-02 19:00:54 +00:00
parent 7deb33b386
commit 5f16c57782
2 changed files with 15 additions and 1 deletions

View File

@ -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() );
}

View File

@ -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.