WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_nav_menu Home Link (2 posts)

  1. Phil Bowell
    Member
    Posted 1 year ago #

    I'm trying to remove the link to the home page in my wp_nav_menu but it's not working. The him page is a static page I set in the preferences. I found this but it doesn't seem to work so I'm obviously doing something wrong. Is there a better way to do this?

    This is my functions.php:

    register_nav_menus(array('primary' => 'Primary Navigation'));
    
    	/* Remove Home Page Link */
    
    	function mytheme_nav_menu_args( $args ) {
    	    $args['show_home'] = false;
    	    return $args;
    	}
    	add_filter( 'wp_nav_menu_args', 'mytheme_nav_menu_args' );

    This is in my header:

    <?php wp_nav_menu( array( 'echo' => true , 'theme_location' => 'Primary Menu' , 'depth' => '1' ) ); ?>

  2. Phil Bowell
    Member
    Posted 1 year ago #

    Nevermind, I fixed it.

Topic Closed

This topic has been closed to new replies.

About this Topic