I am using the WP- Spirit 01 theme and would like to know how can I hide the navigation menu ONLY from the website homepage. I don't have my website live yet. The css code bellow works to hide the menu everywhere not the homepage.

.drop-down ul{

Will be very thankful and happy if someone helps me as soon as possible!

1 Answer 1


You should be able to short circuit the menu by conditionally returning an empty string by adding this code to your theme functions.php :

add_filter( 'pre_wp_nav_menu', 'wpse_210095');
function wpse_210095($menu) {
  if (is_home()) {
   $menu = '';
  return $menu;

You can see in the Core where this logic executes:

260         $nav_menu = apply_filters( 'pre_wp_nav_menu', null, $args );
262         if ( null !== $nav_menu ) {
263                 if ( $args->echo ) {
264                         echo $nav_menu;
265                         return;
266                 }
268                 return $nav_menu;
269         }
  • What to do in order to have the menu showing on phone view? Thank you. Commented Nov 27, 2015 at 19:27
  • I'd have to look through the theme to see how "mobile" is being managed and I don't have time for that.
    – s_ha_dum
    Commented Nov 27, 2015 at 19:31
  • It's worth pointing out something about is_home(). ` * If a static page is set for the front page of the site, this function will return true only * on the page you set as the "Posts page".`
    – crmpicco
    Commented Sep 14, 2017 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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