WordPress.org

Make WordPress Core

Changeset 42107


Ignore:
Timestamp:
11/02/2017 06:59:40 PM (3 years ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r42046 r42107  
    11761176        $changeset_data = array();
    11771177        if ( $this->changeset_post_id() ) {
     1178            /*
     1179             * Don't re-import starter content into a changeset saved persistently.
     1180             * This will need to be revisited in the future once theme switching
     1181             * is allowed with drafted/scheduled changesets, since switching to
     1182             * another theme could result in more starter content being applied.
     1183             * However, when doing an explicit save it is currently possible for
     1184             * nav menus and nav menu items specifically to lose their starter_content
     1185             * flags, thus resulting in duplicates being created since they fail
     1186             * to get re-used. See #40146.
     1187             */
     1188            if ( 'auto-draft' !== get_post_status( $this->changeset_post_id() ) ) {
     1189                return;
     1190            }
     1191
    11781192            $changeset_data = $this->get_changeset_post_data( $this->changeset_post_id() );
    11791193        }
Note: See TracChangeset for help on using the changeset viewer.