Title: Problem excluding a post category
Last modified: August 19, 2016

---

# Problem excluding a post category

 *  [ellipsis](https://wordpress.org/support/users/ellipsis/)
 * (@ellipsis)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/problem-excluding-a-post-category/)
 * Hi,
 * I am using a home-made theme that works perfectly in 2.6, both locally and online.
   I’ve recently upgraded to 2.7 – my theme works perfectly locally (XP Home SP3,
   XAMP Lite 1.6.8 with PHP 5.2.6), but breaks online (PHP 5.2.4, MySQL 4.1.22).
 * I want to exclude all posts in category 5 from the main blog page. I have tried:
   `
   <?php query_posts($query_string . '&cat=-5'); ?>` just before the loop, and `
   <?php if (in_category('5')) continue; ?>'` within the loop.
 * Both methods work fine locally but fail online – all posts are shown.
 * I know that the category number is correct as category-5.php works just as expected.
   I’ve tried uploading a fresh copy of the template to no avail.
 * Any clues as to what could be awry would be very welcome! (I’ve searched the 
   forums for a similar problem without any luck.)
 * Thanks.

The topic ‘Problem excluding a post category’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [ellipsis](https://wordpress.org/support/users/ellipsis/)
 * Last activity: [17 years, 3 months ago](https://wordpress.org/support/topic/problem-excluding-a-post-category/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
