Created
February 21, 2020 21:26
-
-
Save macariojames/880414c4724cfbf058b007a91f7845ab to your computer and use it in GitHub Desktop.
Remove all classes from anchors in navwalker menus (WordPress)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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