WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a WP-Query which I pass post IDs to via

'post__in' => explode(',', $my_ids)

I then want the ability to refine this list by a custom field value (if present).

I have tried including the custom field test in the args for WP-Query but I get my ID list PLUS the custom field post IDs (instead of my IDs filtered by the custom field value).

I also tried adding a query_post after the WP-Query as a filter but that didnt work at all.

How can I filter the query further?

share|improve this question
up vote 0 down vote accepted

Have you tried using meta_query? More details at http://codex.wordpress.org/Class_Reference/WP_Query.

share|improve this answer
Thanks @Dee, I just found it!!! [wordpress.org/support/topic/… this link was very useful too. – Gyro Oct 12 '11 at 12:14
Great to know that! – dchucks Oct 12 '11 at 12:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.