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
This commit is contained in:
Weston Ruter 2017-11-02 18:59:40 +00:00
parent d6aece2a33
commit dc3c350eab
1 changed files with 14 additions and 0 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() );
}