How to Exclude a Category from the WordPress Loop
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:
Sorry, no posts matched your criteria.
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 professional who is one of the most capable people I have ever worked with. His enthusiasm for his job is impressive and his ability to adapt and evolve to a new task is incredible. He is one of those rare people who you can tell where you want to get to and he can engineer the path there for you and give you extra choices along the way. His ability to learn new skills, willingness to continue to grow and expand is astounding. He’s also very skilled at what he does now and has a great eye for design and usability, blending form and function with class. And he’s fun to spend time with.
- Claire Devereux Thompson