From bddb06dd135ca7c41a5f665b50eea152be73d81a Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 6 Jul 2016 05:32:49 +0000 Subject: [PATCH] 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 --- .../customize/class-wp-customize-nav-menu-section.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/customize/class-wp-customize-nav-menu-section.php b/src/wp-includes/customize/class-wp-customize-nav-menu-section.php index fb5eb76891..5518b34705 100644 --- a/src/wp-includes/customize/class-wp-customize-nav-menu-section.php +++ b/src/wp-includes/customize/class-wp-customize-nav-menu-section.php @@ -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; }