Title: Multiple category posts &#8211; exclude certain category
Last modified: August 20, 2016

---

# Multiple category posts – exclude certain category

 *  [Blaque](https://wordpress.org/support/users/blaque/)
 * (@blaque)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/multiple-category-posts-exclude-certain-category/)
 * I use categories (1, 2, 3, etc) and sub-categories (1-1, 1-2, 1-3, etc) to structure
   my posts into different sections of the website. I have a category called ‘Current
   projects’ where I post updates for ongoing projects. These ‘Current projects’
   posts are also divided into the regular category system, such that a post for
   an ongoing project has the categories ‘Current projects’, 1, 1-1, and 1-3 for
   example.
 * My problem is that uncompleted projects show up in the archives when someone 
   views projects by category. Ideally, I would like to hide all posts that have
   been assigned the category ‘Current projects’ so that they are never shown except
   on a page for current projects. When they are completed I simply untick the Current
   projects category for that post and it is shown as normal. How do I do this?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [ninjagowoo](https://wordpress.org/support/users/ninjagowoo/)
 * (@ninjagowoo)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/multiple-category-posts-exclude-certain-category/#post-2234394)
 * You’d have to modify an existing or create a new loop to use for displaying your
   categories. Within that you can use the [category parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters)
   to set up how you want the loop to act based on your category structure.
 *  Thread Starter [Blaque](https://wordpress.org/support/users/blaque/)
 * (@blaque)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/multiple-category-posts-exclude-certain-category/#post-2234402)
 * Thanks, ninjagowoo, for that reply. As I am not very skilled at all in PHP programming,
   would you be able to provide me with some more details of how I would go about?
 *  [oliverchank](https://wordpress.org/support/users/oliverchank/)
 * (@oliverchank)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/multiple-category-posts-exclude-certain-category/#post-2234434)
 * You can exclude a certain category from the archives by adding a bit of code 
   into the archive.php file of your theme right before the loop.
 * For example, using TwentyEleven’s archive.php, I would change this:
    `<?php if(
   have_posts() ) : ?>`
 * to this:
    `<?php if ( have_posts() ) : ?>` `<?php query_posts('cat=-3') ?>`
 * The id 3 refers to the category id you want to exclude.
 * In category.php, add this instead:
    `<?php if (!is_category('3')) { query_posts('
   cat=-3'); } ?>`
 * This excludes your Current Projects posts from every browsing category pages 
   except the Current Projects category.
 * For further reading, there is a lot of information in the codex about [query_posts](http://codex.wordpress.org/Function_Reference/query_posts)
   and [conditional tags](http://codex.wordpress.org/Conditional_Tags).
 *  [weiover](https://wordpress.org/support/users/weiover/)
 * (@weiover)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/multiple-category-posts-exclude-certain-category/#post-2234819)
 * There are two kind of helpful people here at the WP forum:
 * 1. the kind who are knowledgeable, so knowledgable that they simply refuse to
   point people to the solution but to provide links to a bunch of technical readings
   because they believe that no one should take the shortcut even if programming
   is not their profession.
 * 2. the kind who understand the frustration and the level of capability of those
   who don’t understand programming, and to provide concise solution or direction
   to resolve the issues.
 * oliverchank is the #2. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Multiple category posts – exclude certain category’ is closed to new 
replies.

## Tags

 * [multiple categories](https://wordpress.org/support/topic-tag/multiple-categories/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 4 participants
 * Last reply from: [weiover](https://wordpress.org/support/users/weiover/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/multiple-category-posts-exclude-certain-category/#post-2234819)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
