apply_filters( 'wp_nav_menu_args', array $args )
Filters the arguments used to display a navigation menu.
Contents
Description Description
See also See also
Parameters Parameters
- $args
-
(array) Array of wp_nav_menu() arguments.
More Information More Information
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.
Source Source
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
The following code will populate the “theme_location” option if it was not specified (or was left empty) in the initial call to “wp_nav_menu”.
Example migrated from Codex:
The Twenty Thirteen theme defines the following menu in its header.php file.
The following example code will add an ID to the container and change the “depth” to -1 so that links at all levels are displayed in a single, flat list.
The container ID will only show up if you set a menu for this theme location.