Filters the arguments used to display a navigation menu.
$argsarray
menu int|string|WP_Termmenu_class string'menu'.menu_id stringcontainer string'div'.container_class stringcontainer_id stringcontainer_aria_label stringfallback_cb callable|false'wp_page_menu'. Set to false for no fallback.before stringafter stringlink_before stringlink_after stringecho booldepth intwalker objecttheme_location stringitems_wrap stringitem_spacing string'preserve' or 'discard'. Default 'preserve'.The “wp_nav_menu_args” filter is applied to the arguments of the wp_nav_menu() function before they are processed.
This filter can be used in functions.php of a child theme to add/remove/modify the arguments of a menu defined in the parent theme.
Also, plugins can use this filter to change menus by adding classes/IDs or using a custom walker object.
$args = apply_filters( 'wp_nav_menu_args', $args );
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_nav_menu_args