Title: query with multiple custom fields
Last modified: August 19, 2016

---

# query with multiple custom fields

 *  [sierrajoe](https://wordpress.org/support/users/sierrajoe/)
 * (@sierrajoe)
 * [16 years ago](https://wordpress.org/support/topic/query-with-multiple-custom-fields/)
 * I am trying to use a wp_query with multiple custom field key/value pairs. From
   the results I get it seems that only one key/value pair is actually being used
   in the query. for example, with the argument:
    meta_key=post_group_head&meta_value
   =no&meta_key=post_group&meta_value=test I would have expected to only retrieve
   posts with post_group_head=no AND post_group=test. However, what I actually receive
   is posts with post_group=test and no filtering based on post_group_head.
 * Is this expected? is there a way around it?
    Thanks, joe

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years ago](https://wordpress.org/support/topic/query-with-multiple-custom-fields/#post-1531876)
 * The code I showed in [this thread](http://wordpress.org/support/topic/404512?replies=7)
   may help.

Viewing 1 replies (of 1 total)

The topic ‘query with multiple custom fields’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [meta_key](https://wordpress.org/support/topic-tag/meta_key/)
 * [meta_value)](https://wordpress.org/support/topic-tag/meta_value/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/query-with-multiple-custom-fields/#post-1531876)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
