admin管理员组文章数量:1130349
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,
) );
?>
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,
) );
?>
本文标签: Default Wordpress menu content
版权声明:本文标题:Default Wordpress menu content 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749245008a2338729.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论