I'm trying to add some classes to my menu items... I see that the Walker_Nav_Menu calls apply_filters with the 'nav_menu_css_class' tag and two arguments ( $classes and $item )
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
Nevertheless, filter function receives only one argument, i.e. only the $classes array
function my_nav_menu_css_class( $classes = array(), $item ) {
echo "\n<!-- func_get_args: \n"; print_r( func_get_args() ); echo "\n-->\n";
return $classes;
}
add_filter( 'nav_menu_css_class', 'my_nav_menu_css_class' );
keeping the second argument in my function results in "missing argument 2" warning and the value of $item is NULL
... thus to achieve a simple task of adding classes I have to use a Walker class (which works fine) but it should NOT need to be necessary