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.

Prem Tiwari

Prem Tiwari is the founder of and also a professional developer and a blogger by hobby.

Tags: , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.