By default, there is a .current-menu-item class added in the menu li.
we can easily add the active class by simple WordPress filter.
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; }
That's it..!!!!