Customize: Prevent posts/pages imported via starter content from being dropped when adding post/page stubs via nav menus and the dropdown-pages control.
Props westonruter, dlh for testing. Merges [39502] onto 4.7 branch. Fixes #39071 for 4.7. Built from https://develop.svn.wordpress.org/branches/4.7@39503 git-svn-id: http://core.svn.wordpress.org/branches/4.7@39443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
16161be6ac
commit
c34a4c0ba3
|
@ -80,8 +80,6 @@
|
|||
});
|
||||
api.Menus.availableMenuItems = new api.Menus.AvailableItemCollection( api.Menus.data.availableMenuItems );
|
||||
|
||||
api.Menus.insertedAutoDrafts = [];
|
||||
|
||||
/**
|
||||
* Insert a new `auto-draft` post.
|
||||
*
|
||||
|
@ -104,8 +102,9 @@
|
|||
|
||||
request.done( function( response ) {
|
||||
if ( response.post_id ) {
|
||||
api.Menus.insertedAutoDrafts.push( response.post_id );
|
||||
api( 'nav_menus_created_posts' ).set( _.clone( api.Menus.insertedAutoDrafts ) );
|
||||
api( 'nav_menus_created_posts' ).set(
|
||||
api( 'nav_menus_created_posts' ).get().concat( [ response.post_id ] )
|
||||
);
|
||||
|
||||
if ( 'page' === params.post_type ) {
|
||||
|
||||
|
@ -2797,9 +2796,17 @@
|
|||
if ( data.nav_menu_updates || data.nav_menu_item_updates ) {
|
||||
api.Menus.applySavedData( data );
|
||||
}
|
||||
} );
|
||||
|
||||
// Reset list of inserted auto draft post IDs.
|
||||
api.Menus.insertedAutoDrafts = [];
|
||||
/*
|
||||
* Reset the list of posts created in the customizer once published.
|
||||
* The setting is updated quietly (bypassing events being triggered)
|
||||
* so that the customized state doesn't become immediately dirty.
|
||||
*/
|
||||
api.state( 'changesetStatus' ).bind( function( status ) {
|
||||
if ( 'publish' === status ) {
|
||||
api( 'nav_menus_created_posts' )._value = [];
|
||||
}
|
||||
} );
|
||||
|
||||
// Open and focus menu control.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-RC2-39501';
|
||||
$wp_version = '4.7-RC2-39503';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue