I'm trying to hide a menu on a certain page called by it's slug, tried a couple of things but this makes the most sense for me but can't make it to work:

// Load Nav Menu
wp_nav_menu( array( 'theme_location' => 'main-nav' ) );

//Remove menu from basket page
if(is_page('basket')) wp_nav_menu( array ('echo' => 
FALSE, 'fallback_cb' => '__return_false') );
  • 1
    Have you tried if(!is_page('basket')) then doing your wp_nav_menu() call inside the if statement? – WebElaine Jan 12 '18 at 19:44
  • @WebElaine can you clarify your question please (with a code maybe)? thanks – Damir Jan 14 '18 at 21:39
  • Your code is still calling wp_nav_menu() on the basket page. The code I put in the above comment would ensure that wp_nav_menu() is not called on that page where you're trying to exclude it. – WebElaine Jan 17 '18 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.