I have several menus in my theme, but if I don't create menu in dashboard, then in those menus is displayed default menu. How can I avoid that? I don't want any menu content until I create one.
This is my code:
<?php wp_nav_menu(array('theme_location' => 'main_menu_4', 'depth' => 1));?>
I have several menus in my theme, but if I don't create menu in dashboard, then in those menus is displayed default menu. How can I avoid that? I don't want any menu content until I create one.
This is my code:
<?php wp_nav_menu(array('theme_location' => 'main_menu_4', 'depth' => 1));?>
Share
Improve this question
asked Oct 21, 2018 at 12:40
DamianDamian
971 gold badge1 silver badge11 bronze badges
1 Answer
Reset to default 0Use the fallback_cb
argument of wp_nav_menu()
:
(callable|bool) If the menu doesn't exists, a callback function will fire. Default is 'wp_page_menu'. Set to false for no fallback.
<?php
wp_nav_menu( array(
'theme_location' => 'main_menu_4',
'fallback_cb' => false
'depth' => 1,
) );
?>