Exclude a Category from WordPress Homepage Using Code
This method requires you to add code to your WordPress files. If you haven’t done this before, then see our guide on how to copy and paste code snippets in WordPress.
Don’t forget to replace ID (-5) with your category ID. It will hide all blog posts from homepage belonging to the category that matches this ID.
Note: Make sure to add a minus (-) sign with the category ID.
Not sure how to find the category ID? See our guide on how to find category IDs in WordPress.
If you want to exclude multiple categories, then you can change the code like this:
Simply replace the IDs (-5, -9, -23) with your category IDs to exclude them from your WordPress homepage.
We hope this article helped you learn how to exclude a category from your WordPress homepage. You may also want to see these most wanted category hacks and plugins for WordPress that will help you use categories more efficiently.