Title: Problems with query_posts()
Last modified: August 20, 2016

---

# Problems with query_posts()

 *  [Garet McKinley](https://wordpress.org/support/users/igaret/)
 * (@igaret)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/problems-with-query_posts-1/)
 * Okay, so this problem has been bothering me for a while, basically I need to 
   write a VERY complex query for wordpress.
 * Here’s an example of what I’m trying to do.
 * Post 1 has a title “My mac computer is shiny”
    Post 2 has a title “My windows
   computer is really slow” Post 3 has a title “My linux computer is shiny”
 * Now, I’m writing a keyword filter. I have the following keywords that can be 
   toggled:
 * Mac
    Windows Linux Shiny Slow
 * Now, basically when you check the box it’ll look through the title of the posts
   and pull posts containing the keywords. This all works perfect, but I need to
   find a way to do multiples… okay, no problem right? Just use ‘relation’ => ‘OR’
   for the meta_query.
 * WRONG. Because I also have options above for combining the keyword filter with
   a category filter. So if I use ‘relation’ => ‘OR’ It’ll display if it has EITHER
   the category or the keyword. I need it to display ONLY if it’s in the selected
   category and contains the keywords.
 * Any way to do this?
 * _[[No bumping](http://codex.wordpress.org/Forum_Welcome#No_Bumping). If it’s 
   that urgent, consider [hiring someone](http://jobs.wordpress.net/).]_

The topic ‘Problems with query_posts()’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [Garet McKinley](https://wordpress.org/support/users/igaret/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/problems-with-query_posts-1/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
