admin管理员组

文章数量:1122832

I have a very simple question, how do I remove a menu from a WordPress site? Is there a plugin out there that can handle this or do I have to go into my theme's code and remove something from there?

I have a very simple question, how do I remove a menu from a WordPress site? Is there a plugin out there that can handle this or do I have to go into my theme's code and remove something from there?

Share Improve this question asked Aug 14, 2014 at 20:36 TomTom 1431 gold badge2 silver badges10 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

In your admin panel, go to Appearance > Menus > Manage Locations

There you make sure that none of the theme locations have a menu assigned.

Alternatively, you can modify your theme.

If you want to do that, search for calls to wp_nav_menu.

If you take theme twentyfourteen, you have 2 files: header.php and sidebar.php

in header.php the portion to update looks like

    <div id="navbar" class="navbar">
        <nav id="site-navigation" class="navigation main-navigation" role="navigation">
            <h3 class="menu-toggle"><?php _e( 'Menu', 'twentythirteen' ); ?></h3>
            <a class="screen-reader-text skip-link" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentythirteen' ); ?>"><?php _e( 'Skip to content', 'twentythirteen' ); ?></a>
            <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
            <?php get_search_form(); ?>
        </nav><!-- #site-navigation -->
    </div><!-- #navbar -->

Note: if you want to modify a theme, create a child theme as your modifications would be overwritten when you update the theme.

本文标签: How do I remove a menu from a theme