Sometimes you may think to hide a particular page in WordPress from the navigation. There may be instances when you think that you added that page, but now want to remove that page, but don’t actually want to delete that page (may be for SEO purposes). Yes you can hide a page and the solution is this simple.
Firstly, you need to know the page ID of the page which you are going to hide. To do this, login to WordPress and go to Pages and hover the mouse over a page, E.g. if you hover the mouse over About page, then you will see its URL like this in the status bar:
https://www.technostarry.com/wp-admin/post.php?post=2&action=edit
Notice this 2 in the URL and this is the Page ID which we want. OR you can also use Firebug firefox plugin. Just use the inspect tool of firebug and click on that page. You will see its page ID.
Now just go to Appearance > Editor and click on style.css if it is not already selected. Scroll down and add this code at the end of the file:
.page-item-2 { display:none; }
Instead of this 2, you can add the Page ID of the page which you want to hide, and this was just an example.
Firstly locate the page ID and then go ahead and write that ID in the code. So after this, just click on Update File. That’s done. You have just hidden a page from displaying in the front end.
Why hide a Page in WordPress ?
- Because you may not want to delete that page.
- You want to temporarily hide that page for any reasons.
- Maybe for SEO purposes
If you follow this method, then the page will be hidden and will never be displayed anywhere, be it in Navigation or in Widgets. This code will hide that particular Page from everywhere. Enjoy.
stackifieds says
Great stuff. I will really try it out. Thank you for sharing.
vaj says
Really very helpful for designer and blogger like us. We can manage such changes without help of programmer.
Mrinmay Bhattacharjee says
Good Post Man. Finally a solution :)
Saqib says
Yes, a really small and nifty trick for those who don’t want to use any plugin for this purpose.