Customize: Ensure that `WP_Customize_Nav_Menu_Section` is able to represent a placeholder nav menu.

Placeholder nav menus (ones that have yet to be saved into the DB) have negative integer IDs.

Fixes #37293.
Props valendesigns, stubgo, westonruter.


git-svn-id: https://develop.svn.wordpress.org/trunk@37981 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2016-07-06 05:32:49 +00:00
parent 8a1fad3178
commit bddb06dd13
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ class WP_Customize_Nav_Menu_Section extends WP_Customize_Section {
*/
public function json() {
$exported = parent::json();
$exported['menu_id'] = intval( preg_replace( '/^nav_menu\[(\d+)\]/', '$1', $this->id ) );
$exported['menu_id'] = intval( preg_replace( '/^nav_menu\[(-?\d+)\]/', '$1', $this->id ) );
return $exported;
}