Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remove all classes from anchors in navwalker menus (WordPress)
//Put this in your functions.php or custom functionality plugin
// remove all classes from anchors in menus ~mj
function mj_remove_classes_from_all_menu_anchors( $atts ) {
$atts['class'] = ''; // not it's blank; if you add classes like 'example1 class2', it'll add classes ~mj
return $atts;
add_filter( 'nav_menu_link_attributes', 'mj_remove_classes_from_all_menu_anchors', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.