nav_menu_css_class
Filters the CSS class(es) applied to a menu item's list item element.
Description
Parameters (3)
- 0. $array (array) =>
array_filter( $classes )
- The array.
- 1. $item (unknown)
- The item.
- 2. $args (unknown)
- The args.
Usage
- To run the hook, copy the example below.
- $array = apply_filters( 'nav_menu_css_class', $array, $item, $args );
- if ( !empty( $array ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the nav_menu_css_class callback
- function filter_nav_menu_css_class( $array, $item, $args ) {
- // make filter magic happen here...
- return $array;
- };
- // add the filter
- add_filter( 'nav_menu_css_class', 'filter_nav_menu_css_class', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'nav_menu_css_class', 'filter_nav_menu_css_class', 10, 3 );
Defined (1)
The filter is defined in the following location(s).
- /core/menu/weblizar_nav_walker.php
- $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );