Title: Excluding Category Not Working?
Last modified: August 19, 2016

---

# Excluding Category Not Working?

 *  Resolved [justbishop](https://wordpress.org/support/users/justbishop/)
 * (@justbishop)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/excluding-category-not-working/)
 * Anyone know why this would still be showing posts from cat ID 1 on my search 
   results page? I also tried it w/o the single quotes around the -1
 *     ```
       <?php 
   
                       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                                       $term = get_term_by('slug','blog', 'post_tag');
       				$term2 = get_term_by('slug','gallery', 'post_tag');
       				$args=array(
         					'tag__not_in' => array($term->term_id, $term2->term_id),
                                               'category' => '-1',
         					'post_type' => 'post',
         					'post_status' => 'publish',
         					'caller_get_posts'=> 1,
         					'paged' => $paged
       				);
   
                       query_posts($args);
   
                       if (have_posts()) : ?>
       ```
   

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/excluding-category-not-working/#post-1829607)
 * [http://codex.wordpress.org/Function_Reference/query_posts#Category_Parameters](http://codex.wordpress.org/Function_Reference/query_posts#Category_Parameters)
 * try `'category__not_in' => array(1),`
 * or
 * `'cat' => -1,`
 *  Thread Starter [justbishop](https://wordpress.org/support/users/justbishop/)
 * (@justbishop)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/excluding-category-not-working/#post-1829608)
 * First solution worked, thanks!!

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

The topic ‘Excluding Category Not Working?’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [justbishop](https://wordpress.org/support/users/justbishop/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/excluding-category-not-working/#post-1829608)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
