Last active
June 16, 2019 08:01
-
-
Save wplit/f346d2378d47a2498d371782341756e1 to your computer and use it in GitHub Desktop.
Strip WP menu markup down to bare minimum
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
// Removes all CSS classes & ID's from menu items (only allows those listed) | |
add_filter('nav_menu_css_class', 'lit_strip_nav_menu'); | |
add_filter('nav_menu_item_id', 'lit_strip_nav_menu'); | |
function lit_strip_nav_menu($var) { | |
return is_array($var) ? array_intersect($var, array( | |
'current-menu-item', | |
'menu-item', | |
'menu-item-has-children', | |
'sub-menu' | |
) | |
) : ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment