Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Remove 'Home' Link from wp_nav_menu!

Tags:

php

wordpress

How do I get rid of the 'Home' link from appearing at the top of my links when using <?php wp_nav_menu( array('menu' => 'news', 'show_home' => false)); ?>

I tried 'show_home' => false and 'show_home=0' but neither worked.

like image 722
Beto Avatar asked Mar 30 '11 21:03

Beto


2 Answers

This should be in your functions.php

function page_menu_args( $args ) {
    $args['show_home'] = FALSE;
    return $args;
}
add_filter( 'wp_page_menu_args', 'page_menu_args' );

EDIT: Dont forget to add this to wherever your menu is supposed to print out:

wp_nav_menu( array('echo'=>true)); 
like image 110
Chris McClellan Avatar answered Nov 04 '22 01:11

Chris McClellan


The following worked for me:

 _nav_menu( array( 'container_id' => 'topmenu', 'depth' => 0, 'menu_class' => 'sf-menu', 'theme_location' => 'topmenu' ) );

And I add

 function page_menu_args( $args ) {
     $args['show_home'] = FALSE;
     return $args;
 }
 add_filter( 'wp_page_menu_args', 'page_menu_args' );

In the functions.php file.

like image 1
dudn04 Avatar answered Nov 04 '22 01:11

dudn04