WordPress filter hook · part of WordPress core
wp_nav_menu_container_allowedtags
A WordPress core filter that 11 plugins also fire themselves, running on 122K+ sites between them.
“Filters the allowed tags for the wp_nav_menu_container.”
How to use wp_nav_menu_container_allowedtags
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'wp_nav_menu_container_allowedtags', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Argument names come from BuddyPress's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
11 plugins that fire wp_nav_menu_container_allowedtags
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
BuddyPress90,000+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav', ) )bp-core/bp-core-template.php:3643 -
Essential Widgets10,000+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )includes/widgets/class-ew-menus.php:80 -
Advanced Custom Fields: Nav Menu Field8,000+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )nav-menu-v4.php:157 -
EasyMega5,000+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )inc/menu.php:126 -
Groovy Menu Plugin (Free)4,000+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )includes/modules/core/inc/GroovyMenuUtils.php:2022 -
ACF Nav Menu Field3,000+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )includes/field/nav-menu.php:84 -
Widgets Reloaded1,000+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )inc/widgets/class-nav-menu.php:114 -
MAS Elementor800+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )classes/class-wp-bootstrap-navwalker.php:396 -
Voce Cached Nav100+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )voce-cached-nav.php:242 -
Line Style Menus10+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )line-style-menu.php:223 -
ShopCode Menu Horizontal WooCommerce10+ installs
apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) )shopcode-menu-horizontal-woocommerce.php:115
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.