Many navigation bars in WordPress are created dynamically with this piece of code
Since it is created dynamically, people often wonder how to exclude certain pages from the navigation. I have a lot more pages than I want listed there and I need a way to remove them.
Here I’m going to list three ways that you can do that. One is a code solution and the other two require the use of a plugin.
I have always attempted to use a code rather than a plugin solution but when there are a lot of pages to exclude or when the site is being created for a client, it may be best to use a plugin. Right now, I have so many pages excluded through the code that it may be easier for me to switch to a plugin in order to manage it. Especially since I have a navigation menu at the top and at the bottom of the page.
Way back I wrote an article about how to exclude pages from the WordPress navigation bar manually. Instead of repeating that information, I have linked to the article. Nothing has changed and the exclude code still works perfectly.
Exclude Pages Plugin
The Exclude Pages Plugin adds a checkbox to the Edit page screen that says “include this page in menus”. When the plugin is installed the checkbox is checked by default. If you want to exclude the page, simply uncheck that checkbox.
The pageMash plugin is the one that I prefer to install on client sites because it has additional functionality. In addition to hiding pages from the navigation bar, this plugin also provides a drag and drop interface that can be used to manage the order in which the pages appear on the navigation bar. It also provides a quick way to edit and rename the pages. Once installed, pageMash will be under the Pages menu.
Do you exclude pages from your navigation bar? Do you use any of these methods? Or do you use a different plugin that you like better?
photo credit: duncan (Wow! No tiaras with an apostrophe and an incorrect spelling of jewelry – gotta love it.)