Support » Fixing WordPress » Exclude Page From Menu

  • Trying to exclude page from Nav menu but can’t seem to get all the pages to remove. Here is my code:

    <?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’,’exclude’=>100,’exclude’=>228,’exclude’=>259, ‘theme_location’ => ‘primary’ ) ); ?>

    Using this code it will exclude 100 and 259 but 228 keeps showing on the menu can someone please tell me what I am doing wrong.

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try using this code.
    <?php wp_nav_menu( array( 'container_class' => 'menu-header','exclude=100,228,259', 'theme_location' => 'primary' ) ); ?>

    A better way of doing this would be to use the custom menu under the Appearance>>Menus if your theme supports it.

    Thanks but that does not work either now the only pageid that is not showing is 100 the other 2 now show on nav menu.

    This was a custom designed site so somewhat afraid to use the custom menu function for fear it may damage the entire site if it does not fit within the area properly.

    With creating a custom menu you can select which is your primary menu, so I cannot see how you can break it, if it does not work switch it back.

    Another way is to make the page private under Publish visability on the page editor, you can still link to these pages manually, I use this for footer links, and other content pages that I do not want in the main menu.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude Page From Menu’ is closed to new replies.