wphooks.info - wp_nav_menu_container_allowedtags

wp_nav_menu_container_allowedtags

(trunk - 5.1-alpha-44286)

The hook occurs in the following file:

wp-includes/nav-menu-template.php:
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
	$show_container = false;
	if ( $args->container ) {
		/**
		 * Filters the list of HTML tags that are valid for use as menu containers.
		 *
		 * @since 3.0.0
		 *
		 * @param array $tags The acceptable HTML tags for use as menu containers.
		 *                    Default is array containing 'div' and 'nav'.
		 */
		$allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) );
		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 ) . '"' : '';
			$nav_menu      .= '<' . $args->container . $id . $class . '>';
		}
	}

	// Set up the $menu_item variables