
Remove every class and ID from the wp_nav_menu
Answers 1
-
Remove class and Id attribute from list item in wordpress menu
--PATH wp-content\themes\<yourTheme>\functions.phpadd_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1); add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1); add_filter('page_css_class', 'my_css_attributes_filter', 100, 1); function my_css_attributes_filter($var) { return is_array($var) ? array_intersect($var, array('current-menu-item')) : ''; }
0Using this code snippet you can remove every class and ID attribute from the list of wordpress menu. You can remove all class and ID attribute with their values from <li> list item in menu list. It will show only the passed value to the current menu item. wp_nav_menu() function displays a navigation menu which allows you to navigate to most parts of your website.
Random Code Snippet Queries: Wordpress
- Remove class from body tag in wordpress
- Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/xxx/public_html/wp-includes/plugin.php on line xxx
- Show template file name in wordpress
- Add new class to body tag in wordpress
- How to display author avatar in Wordpress 5