How to remove specific page(s) link from the WordPress Navigation

When we list the pages in the WordPress to show the navigation to the pages we have on our blog/site by using this code:

<?php wp_list_pages(); ?>

It displays the list of the pages we have in our WordPress blog installation in a navigation form, showing links to all the pages.

edit wordpress navigation to remove/exclude page item from listNow some times we want to remove some of the links / pages from being listed in the navigation of WordPress pages. Here is how to exclude those unnecessary links from being displayed in the wordpress navigation for pages.

You need to add some in the list pages code for wordpress pages navigation, and also tell it the id of the page that you want to be excluded/removed. To get the number/id of the page that you want to remove, simply goto wordpress admin, and goto pages(edit pages) and there click on the page you want to be removed/excluded from the wordpress navigation for pages. On next edit page, note the url(address) of the page that you are on, and not down the last post number in it. It should be like this:

http://www.domain.com/wp-admin/page.php?action=edit&post=92

So in this case, the page number was 92. Now simply change your navigation code for wordpress pages to this one including the variable exclude to remove the specified page from the wordpress pages navigation:

<?php wp_list_pages(exclude=92); ?>

If you want to exclude more than one pages in the wordpress navigation, simply add them there seperated by comma (,) like this:

<?php wp_list_pages(exclude=92,93,94); ?>

Hope it solves the problem. Lemme know if you are in some other situation and want it to be fixed.

16 comments on “How to remove specific page(s) link from the WordPress Navigation

  1. I really like the widget and have recently installed it however I am unable to modify any of the attributes of the widget. I am not sure if I can or not. The options interface seems to be ineffective. I am currently using WordPress 2.3
    Yeaar, super plugin! Thanks a LOT!
    thx for this plugin

  2. I have the following code Using Iphone template:

    <a href="”>  <img src="/images/home-icon.png” />  

    Cant seem to get rid of page 23 from menu and tried different variations of the code. Can any one help

  3. Assalamu Alaikkum Nabeel
    Great Post One more thing is if you are using certain themes like studiopress,pyrmont etc you have to add “If ($the_page_id!=3 && $the_page_id!=2) before if (is_page($the_page_id)) ” ie the pages you are excluding are 3 and 2 so that it works great Happy Eid ul-Alha Friend

  4. I am the first time on this site and am really enthusiastic about and so many good articles. I think it’s just very good.

  5. Hey i am having one problem in my navigation bar the problem is all my categories are displaying in the navigation bar so i want to fix this problem so plz have a look on the site and plz suggest me step by step to fix this problem. http://www.salmankhanzone.com/

    1. i saw it earlier (you removed categories now maybe) however you need to add filter to the categories list to hide some of them

      let me know if you want me to do this for you.

    1. you’re welcome

      one more thing, install: firebug and page speed plugin by google and then optimize / replace your theme to make it light weight + bug free. Try keeping your page below 100kb (or 200kb atleast)

      1. I really appreciate for your support, thanks man yes i am already using firebug and page speed plugin my site is still under construction so working on that.

        Thanks man for your support again :)

        1. btw, use w3 total cache on your blog too, it’s really a wonderful plugin (when configured properly) I might be making a post on it’s use and configuration too

Leave a Reply

Your email address will not be published.