From 61d6854bae2d315e117bc848483ae3e29520c836 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 27 Sep 2015 18:12:20 +0000 Subject: [PATCH] Nav Menus: in `wp_nav_menu()`, `$container` is already bound to a list of allowed tags. PHP, being its whimsical self, while return `true` if someone sets `$container` to `true` via `in_array( true, [ 'div', 'nav' ] )`. Check that `$container` is a string before the `in_array()` check. `'true'` does not pass. Props shedonist for the original patch. Fixes #32464. git-svn-id: https://develop.svn.wordpress.org/trunk@34630 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/nav-menu-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php index 12ab81d4ac..13a9e735f4 100644 --- a/src/wp-includes/nav-menu-template.php +++ b/src/wp-includes/nav-menu-template.php @@ -334,7 +334,7 @@ function wp_nav_menu( $args = array() ) { * Default is array containing 'div' and 'nav'. */ $allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) ); - if ( in_array( $args->container, $allowed_tags ) ) { + if ( is_string( $args->container ) && in_array( $args->container, $allowed_tags ) ) { $show_container = true; $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"'; $id = $args->container_id ? ' id="' . esc_attr( $args->container_id ) . '"' : '';