I am using this code to call any custom menu and display:
<?php
wp_nav_menu( array(
'container' => 'none',
'container_class' => 'menu-header',
'theme_location' => 'primary',
'menu' => get_post_meta( $post->ID, 'MenuName', true) )
); ?>
At the moment if there is no custom menu defined it falls back to the primary menu.
I am trying to edit this code, so if there is no custom menu then display nothing. Having no luck, doesn’t help that I’m new to php and wordpress. I have searched online and tried a few other solutions. Knowing my luck it’s probably something really simple.
If anyone could help me out, I’d appreciate it a lot!
Thanks
Simply set it to a predefined core-function that returns
null
orfalse
:the wp_nav_menu fallback is wp_page_menu() by default. you think you could change the fallback to a null string
or you could first test for the presence of a menu?