Home »
Information Technology »
How to Add Wordpress Pages Without Adding Them to Navigation Menu
Sometimes when creating a new page, we do not want the page appears on the page navigaton menu. WordPress itself does not provide that option when creating a new page. To apply it, we must change it manually in the header.php file located in the current active theme directory.
How to apply:
- Create a new page and publish it
- Edit the header.php file located in the current active theme directory
- Find the wp_list_pages function, add the argument exclude = id, where id is the id of the page that will be excluded. Use commas to separate each id if you want to exclude more than one pages, e.g. wp_list_pages ( ‘exclude = 20,21′).
- To get the id of each page, go to the Edit Page menu, place the cursor on the edit link and get the id of the page found on the page url (wp-admin/page.php?action=edit&post=20).
Related post:
Hi Admin,
Thanks a lot for the post. It saved my lot of time since I was planning for a plugin but didn’t that its so simple.
BR,
Shubhamoy
just to let you know i have found a perfect plugin called “Hide pages”
Thanks a lot. I was searching to avoid a terms of use page from navigation, this helped me.