Title: query_posts excluding categories doesnt seem to be working in 2.7
Last modified: August 19, 2016

---

# query_posts excluding categories doesnt seem to be working in 2.7

 *  [preppeller](https://wordpress.org/support/users/preppeller/)
 * (@preppeller)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/query_posts-excluding-categories/)
 * I am having a problem with query posts in 2.7.1 for a front page template.
 * Previously I used the following line which used to work fine:
 * `query_posts('showposts=4&cat=-113');`
 * However this now seems to incorrectly show items in category 113. The only way
   I have managed to get it to work is using the following query:
 *     ```
       query_posts(array(
         'showposts' => 4,
         'category__not_in' => array(113),
       ));
       ```
   
 * This has worked in the past before 2.7 without changes to the code so is there
   a bug in 2.7 which breaks this or was I doing something unexpected?
 * Interestingly, changing the initial query_posts to show only categories from 
   113 (remove minus sign) works fine.

The topic ‘query_posts excluding categories doesnt seem to be working in 2.7’ is
closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [preppeller](https://wordpress.org/support/users/preppeller/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/query_posts-excluding-categories/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
