Exclude a Category from the Front Page in Wordpress

To prevent posts from a certain category from showing up on your front page in Wordpress, put this in your index.php (or the template where you want to exclude a category from your page, maybe archive.php) BEFORE the loop:

The category number to exclude in my example is 53. You can replace that number with whichever category you want to exclude. To exclude more than one category, just separate with a comma, so:

To determine the category’s number, just open your admin panel, and go to –posts–categories and then hover your mouse pointer over the category in question, while watching the status bar of your browser, or just click on one of the category names there. The last bit in the url is the category number, like “cat_ID=53″
I wanted to exclude all video posts from my front page cannabisfantastic.com because they sort of block the news and other content. By using this method, I can still have a video category but the video posts don’t automatically show up on top distracting from my other posts. See the The Loop page at the Wordpress Codex for more information.

This entry was posted in web development, wordpress. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Leave a reply