How to Exclude Category Post From Homepage

Prem Tiwari - - WordPress, WordPress Snippets

If you want to exclude some specific categories posts from home page, then this tutorial for you. Pay attention in this tutorial as I am going to explain how to exclude category post from the homepage.
This is a simple code, which will exclude the categories posts to display on your home page. You need to pass those category ids in the below function, which you does not want to display.

Open functions.php file from your current theme folder and copy paste below code at the end of the file and save. In the below, code 9, 14, and 5 are the category ids. All the posts which belong from these categories will not display on the homepage, but it will be displayed on the category and search page.

About: Prem Tiwari

Prem Tiwari is the founder of and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.

Tags: , , , , ,