I’ve noticed if you add child pages to a page in the main menu WordPress automatically puts in a nested list called .children
. When hovering over the parent page in the main menu a ‘dropdown’ menu is displayed.
Basically, I’d like to disable this and I can’t way a way to do it within the CMS. I have a menu displaying the child pages in the page sidebar, so I have no use for it.
Any ideas?
My parent theme functions.php has the menu set up like this:
function html5blank_nav()
{
wp_nav_menu(
array(
'theme_location' => 'header-menu',
'menu' => '',
'container' => 'div',
'container_class' => 'menu-{menu slug}-container',
'container_id' => '',
'menu_class' => 'menu',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul>%3$s</ul>',
'depth' => 0,
'walker' => ''
)
);
}
So it’s pretty standard. I can’t find a lot of info on the child menu. I thought it would’ve been a common request for it to be on/off.
I guess I could create a custom menu in Appearance > Menus but I’d rather stay away from that if possible as it could be a pain to manage future additional pages?
Hope someone can help! 🙂
Read more here: Disable WordPress main menu dropdown (child menu)