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.

What's the Buzz?

Andy is a true top notch programmer with a great eye for design, style and balance. When I out source web development projects, I look for qualified and competent programmers that can understand the big picture, add value throughout entire process, and pays close attention to the details – Andy fits the bill.

Andy is well-versed in web development using various programming languages and CMS platforms. Andy is able to deliver a flawless website based on the creative vision and project requirements. He is able to do it on time and on budget.

I highly recommended Andy as a web developer and give him four stars on his professionalism.

- John LeDonne
LeDonne Creative