If you are into WordPress websites you will most likely come across the problem of a page that you do not want showing appearing in the top navigation menu. Sometimes you can install a plugin to help customize the top navigation menu, however these plugins react differently for each WordPress theme. This is why I like to remove or exclude the pages I do not want in the top navigation menu manually. I do this by editing the php code in the header.php.
How to remove or exclude a page from the navigation menu in WordPress?
1. Sign in to your WordPress dashboard
2. Click on the appearance link in the side menu
3. Then choose editor
4. Some themes are different, however in this case I want to edit the header.php file
5. Click on header.php to edit
6. Find <?php wp_list_pages(‘title_li=’); ?> or something similar
7. Paste the new code in: <?php wp_list_pages(‘exclude=32&title_li=’); ?>
8. If you have menus with submenus than use this code: <?php wp_list_pages(‘depth=2,3,5&exclude= 2&title_li=’); ?>
Watch this video tutorial showing you how to add the code into the header.php file.
Here is another example of how I had to customize this code to get it to work.
$string = wp_list_pages(‘title_li=&echo=0&depth=1&exclude=3962,4779′);
As you can see it is very similar to the previous examples.




{ 12 comments… read them below or add one }
For me the new version is nice than to the old wordpress.. because there something with this new version..
Brenda Macalino recently posted..singapore home loans
hi
I am using the easel theme which does not have the code in the header.php that you refer to – any suggestions where else it could be.
I wish developers would not include page titles at the top as it looks cumbersome when you have many pages.
Hi
I’m having the same problem. I’ running my WP with Easel theme and I cannot hide pages from menu. header.php doesn’t have wp_list_page instead of that, there’s a menubar.php wich doesn’t include this code. HELP!
Thanks for this help. I’ve started using 8Bit’s “Standard Theme” recently and they seem to be processing the Top Menu differently. The work around I discovered was to simply make certain the “offending” page had a parent in the Page Attributes. Hope this helps.
Thanks dude! That worked perfectly for me.
I tried this and it didn’t work and then I went back to the way it was like you said and I got this error message
Parse error: syntax error, unexpected ‘=’ in D:\Hosting\2756737\html\wp-content\themes\snapshot\header.php on line 67
What i am trying to do is remove the existing home page to make my second page the home page and I can’t seem to get that to work. Any suggestions?
@Jenny
I just came across this post and ended up with exactly same error.
After dropping it into my text editor, rather than making the edits in the WP Admin, I noticed that if you cut and paste from this page that the apostrophes are actually smart apostrophes.
Just swap them out and it works like a charm.
Hey it’s not working please can you help me i cant find the Editor link at the Appearance bar… I have the Digg Colummn theme and i really need to remove the pages im stuck
Hi there
I am not sure if you have an editors link in the free hosted Wordpress. If it is not there then it means you cannot do this.. I had a free hosted Wordpress website years ago and found that it had many things I couldn’t do so I bought my own web hosting space.
Awesome. Just pasted the code into my header, on Wordpress 3. Omitted the page.
THANK YOU for the tip. Really saved me here.
Casey recently posted..youtube
Glad to help…It’s great to find the answer to a problem quickly without having to waste too much time.
What about the same in the latest Wordpress 3.0 ?
Acer recently posted..Acer Aspire 4736Z Laptop – Windows 7