Title: Exclude Post Category
Last modified: August 21, 2016

---

# Exclude Post Category

 *  [Evypoo](https://wordpress.org/support/users/evypoo/)
 * (@evypoo)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/exclude-post-category/)
 * Hello,
 * I have a custom post type called woo_video and categories called woo_video_categories.
   Many of the videos are listed under multiple categories. I would like to control
   what videos are shown by using a category (so either excluding one particular
   category or including a particular category. for example: ‘Exclude from Home’
   or ‘Include in Home’). I believe that I am able to find the category ID (and 
   the ID I was trying to exclude was 51). I have tried:
 *  <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php $
   args = array( ‘post_type’ => ‘woo_video’, ‘posts_per_page’ => 9, ‘woo_video_category’
   => -51 );
 * And:
 * <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php $args
   = array( ‘post_type’ => ‘woo_video’, ‘posts_per_page’ => 9, ‘cat’ => -51 );
 * And:
 * <?php query_posts($query_string . ‘&cat=-51’); ?>
    <?php if ( have_posts() ) :
   while ( have_posts() ) : the_post(); ?>
 * And:
 * <?php query_posts($query_string . ‘&woo_video_category=-51’); ?>
    <?php if ( 
   have_posts() ) : while ( have_posts() ) : the_post(); ?>
 * I have also tried the ‘category__not_in’ command. Nothing seems to work.
 * Any idea what I am doing wrong? Is it because the videos fall into multiple categories?
   I would like to exclude category ID 51 even if other categories are assigned.
   As stated above, I am also open to a loop that includes all that fall under a
   specific category.
 * Thank you in advance!

The topic ‘Exclude Post Category’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Evypoo](https://wordpress.org/support/users/evypoo/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/exclude-post-category/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
