How to Exclude a Category from the WordPress Loop

Wordpress How-To's

Here’s the question that was asked:

“Basically I want to take all of the posts in the “Freelance” category and remove them from the main content so that I can link to them from a page instead of including them in the Loop. “

Here is the code to exclude an entire category from appearing within the WordPress loop:

{code type=php}

Sorry, no posts matched your criteria.
{/code}

Basically, what you’re doing with the above code is telling the loop that if it’s in category 3, just remove it from the query that the loop is using.

Hopefully you’ve found this quick tutorial valuable. Contact me if you have any questions or would do it a different way. There’s 1,001 ways to do everything – that’s why I love coding.

Leave a Reply

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

What's the Buzz?

Andy did a tremendous job in developing a new website for our company from scratch. His vision in developing a “state of the art” website for a furniture retailer was key to making our website one of the top sites in our industry. He was tireless in working to develop new ideas and translate them into a working part of our site.

- Paul Sanford
COO, Roomful Express Furniture