WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm building a landing page and want to remove the navigation menu from the page. The navigation menu is in header.php which is of course in the page template. Is there a WordPress function I can use to remove the navigation menu from this specific page? I know I could do it with jQuery and do display:none for the nav menu but i'd like to do it server side before the page loads.


share|improve this question
up vote 3 down vote accepted

Use a conditional tag:

Codex References:

Function Reference (is_page)

Function Reference (Conditional Tags)

You can specify the landing page by Page ID, Page Title or Page Slug.

Here is an example:

<?php if ( !is_page( 'landing-page' ) ) { 
  wp_nav_menu( array( 
    'show_home' => 'Home', 
    'container' => 'false', 
    'theme_location' => 'main') 

It excludes the page (in this case the page with the slug "landing-page") by placing the ! in front of is_page

No need for javascript, this should do the trick.

share|improve this answer

I just answered on a duplicate question, but another solution is to filter wp_nav_menu.

Conditional logic will probably work as long as you haven't messed around with the query object and forgot to reset it.

function wpa76334_filter_nav_menu($menu, $args){
    if( is_page_template('your-template.php')) $menu = null; //use your own conditions
    return $menu;
add_filter('wp_nav_menu','wpa76334_filter_nav_menu', 10, 2);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.