When we implemented the bootstrap menu in WordPress. you may be frustrated with the built-in menu options. There isn’t an easy way to tell WordPress to swap out the current menu item class with bootstrap’s active class. there is given below hook. this following script write a script in the fucntion.php file

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;


Leave a Reply

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