Adding the following snippet into your theme’s functions.php file will let you remove CSS selector attributes from WP-nav menu in WordPress.
1 2 3 4 5 6 | <?php function remove_css_selector_attributes($input) { return preg_replace('/ (id|class)=\"(.*?)\"/', '', $input); } add_filter( 'wp_nav_menu', 'remove_css_selector_attributes' ); ?> |
Snippet Source/Credit: WP-Snippets.com