wp_nav_menu_args
The WordPress Core wp nav menu args hook.
Description
Parameters (2)
- 0. $array (callback) =>
array( $this, 'filter_wp_nav_menu_args' )
- The array.
- 1. $int (int) =>
1000
- The int.
Usage
- To run the hook, copy the example below.
- $array = apply_filters( 'wp_nav_menu_args', $array, $int );
- if ( !empty( $array ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the wp_nav_menu_args callback
- function filter_wp_nav_menu_args( $array, $int ) {
- // make filter magic happen here...
- return $array;
- };
- // add the filter
- add_filter( 'wp_nav_menu_args', 'filter_wp_nav_menu_args', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'wp_nav_menu_args', 'filter_wp_nav_menu_args', 10, 2 );
Defined (2)
The filter is defined in the following location(s).
- /wp-includes/class-wp-customize-nav-menus.php
- add_filter( 'wp_nav_menu_args', array( $this, 'filter_wp_nav_menu_args' ), 1000 );
- /wp-includes/nav-menu-template.php
- $args = apply_filters( 'wp_nav_menu_args', $args );