How to remove ul-class in wp_nav_menu?
'items_wrap' => '%3$s',
'container' => false
Adding above does not work.
To remove ul class from wp_nav_menu, you will have to define menu_class
to false. Default wp_nav_menu ul menu class is menu
.
<?php wp_nav_menu( array( 'container' => false, 'items_wrap' => '<ul>%3$s</ul>', 'theme_location' => 'mainmenu' ) ); ?>
I added mainmenu
as theme_location
. You should change it to your theme location.
Read full list of args on wp_nav_menu codex page.
EDIT:
To remove id and classes from ul menu you can define your menu like this.
'container' => false,
'items_wrap' => '<ul>%3$s</ul>'
If you want to remove ul
and div
from the function wp_nav_menu()
, you can use this code:
if ( function_exists( 'wp_nav_menu' ) ) {
wp_nav_menu( array(
'menu' => 'main_nav', // main_nav means menu id
'container' => '',
'items_wrap' => '%3$s'
) );
}
menu_class
parameter?