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


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: