Snippet: Remove ‘current-menu-parent’ Class from WordPress Menu
function myprefix_edit_classes( $classes, $item ) {
if ( ( $key = array_search( 'current-menu-parent', $classes ) ) !== false ) {
unset( $classes[$key] );
}
return $classes;
}
add_filter( 'nav_menu_css_class', 'myprefix_edit_classes', 10, 2 );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
We recommend Code Snippets (100% Free) or WPCode (sponsored)