Apply function only for specific menu / menu location

I use this function

add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);

function special_nav_class ($classes, $item) {

if (in_array('current-menu-item', $classes)){
    $classes[] = 'active ';
}

return $classes;
}

But how to use it only for one of my menus or menu locations?

Read more here: Apply function only for specific menu / menu location

Leave a Reply

Your email address will not be published. Required fields are marked *