Title: Select &#8220;!=&#8221;
Last modified: August 19, 2016

---

# Select “!=”

 *  [zszalbot](https://wordpress.org/support/users/zszalbot/)
 * (@zszalbot)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/select/)
 * Hello,
 * I would like to know how to write a negative select query:
 * `$myposts = get_posts('category=3&numberposts=5&offset=0');`
 * I would actually like to select all posts BUT those who are in category 3. How
   can I do that?
 * Many thanks!

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

 *  [kwbridge](https://wordpress.org/support/users/kwbridge/)
 * (@kwbridge)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/select/#post-931013)
 * The section Exclude Posts from Some Category a little down the page should help.
 * [http://codex.wordpress.org/The_Loop](http://codex.wordpress.org/The_Loop)
 *  Thread Starter [zszalbot](https://wordpress.org/support/users/zszalbot/)
 * (@zszalbot)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/select/#post-931035)
 * Thank you! I think this is what I need!
 * Just one final question.
 * `<?php if (in_category('3')) continue; ?>`
 * If I wanted to exclude more than one category, can I write it as:
 * `<?php if (in_category('3')) or (in_category('4')) continue; ?>`
 * Thanks!
 * Zbyszek
 *  [kwbridge](https://wordpress.org/support/users/kwbridge/)
 * (@kwbridge)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/select/#post-931049)
 * You might want to try this instead.
 * [http://codex.wordpress.org/Template_Tags/query_posts](http://codex.wordpress.org/Template_Tags/query_posts)

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

The topic ‘Select “!=”’ is closed to new replies.

## Tags

 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)
 * [select](https://wordpress.org/support/topic-tag/select/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [kwbridge](https://wordpress.org/support/users/kwbridge/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/select/#post-931049)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
