Snippets: 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 );

Snippet Type: PHP

Posted Under: Menu

All PHP snippets should be added via a child theme's functions.php file.