How can I remove a menu item programmatically?

I’m using the built in menu manager to create my menues and I disaply them by using wp_nav_menu().

I’m wondering, is it possible to remove certain menu items from being displayed based on some specific condition?

Related posts

Leave a Reply

3 comments

  1. Use the wp_nav_menu_objects filter to adjust the menu items using whatever conditions you like. The filter will receive and return an array of the menu items.

  2. if our menu is pages you can use Exclude Pages from List

    Just use the id of pages sepearated b comma

    <ul>
      <?php wp_list_pages('exclude=17,38' ); ?>
    </ul>
    

    UPDATE

    Try this one

    Go to Appearance -> Menu and then from there click “Create Menu” then add menus that you want to include and you can set a Location for menus with this code below try to explore

    http://codex.wordpress.org/Function_Reference/wp_nav_menu