diff --git src/wp-includes/class-wp-customize-nav-menus.php src/wp-includes/class-wp-customize-nav-menus.php
index e263e3f391..8401be51d0 100644
|
|
final class WP_Customize_Nav_Menus { |
1276 | 1276 | |
1277 | 1277 | $args['customize_preview_nav_menus_args'] = $exported_args; |
1278 | 1278 | $this->preview_nav_menu_instance_args[ $exported_args['args_hmac'] ] = $exported_args; |
| 1279 | |
| 1280 | // @todo Refactor for PHP 5.2. |
| 1281 | if ( $can_partial_refresh && ! empty( $args['fallback_cb'] ) ) { |
| 1282 | $original_fallback_cb = $args['fallback_cb']; |
| 1283 | $args['fallback_cb'] = function ( $fallback_args ) use ( $original_fallback_cb ) { |
| 1284 | ob_start(); |
| 1285 | $fallback_args['callback_cb'] = $original_fallback_cb; |
| 1286 | call_user_func( $original_fallback_cb, $fallback_args ); |
| 1287 | $output = ob_get_clean(); |
| 1288 | echo $this->filter_wp_nav_menu( $output, $fallback_args ); |
| 1289 | }; |
| 1290 | } |
| 1291 | |
1279 | 1292 | return $args; |
1280 | 1293 | } |
1281 | 1294 | |
… |
… |
final class WP_Customize_Nav_Menus { |
1294 | 1307 | * @return null |
1295 | 1308 | */ |
1296 | 1309 | public function filter_wp_nav_menu( $nav_menu_content, $args ) { |
| 1310 | $args = (object) $args; |
1297 | 1311 | if ( isset( $args->customize_preview_nav_menus_args['can_partial_refresh'] ) && $args->customize_preview_nav_menus_args['can_partial_refresh'] ) { |
1298 | 1312 | $attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'nav_menu_instance[' . $args->customize_preview_nav_menus_args['args_hmac'] . ']' ) ); |
1299 | 1313 | $attributes .= ' data-customize-partial-type="nav_menu_instance"'; |
diff --git src/wp-includes/js/customize-preview-nav-menus.js src/wp-includes/js/customize-preview-nav-menus.js
index 6745b41be8..ac2bfcde5c 100644
|
|
wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( |
212 | 212 | } else if ( partial.params.navMenuArgs.theme_location && api.has( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' ) ) { |
213 | 213 | menuId = api( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' ).get(); |
214 | 214 | } |
215 | | if ( ! menuId ) { |
| 215 | if ( ! menuId && ! partial.params.navMenuArgs.fallback_cb ) { |
216 | 216 | partial.fallback(); |
217 | 217 | deferred.reject(); |
218 | 218 | return deferred.promise(); |