I have a collection of posts for families. I'm using the simple fields plugin for handle members of the family. Is there a simple way to query posts based on values from the custom fields created by the simple fields plugin.

I see the meta keys in the admin:



where fieldID_1 is a dropdown for year (1950-2010),
fieldID_2 is a dropdown for gender (male or female)
fieldID_3 is a textfield for name

How would I query to get all posts where gender is 'male' and ordered by year?



There are numInSet_N values. Some might have 0, others 10 or more.

The simple fields plugin creates generic values for each key. For example, _simple_fields_fieldGroupID_6_fieldID_1_numInSet_0 is a dropdown for year and has the following key values:


Where dropdown_num_2 is actually 1950, dropdown_num_3 is 1951 and so forth.

The same is true for the gender dropdown, _simple_fields_fieldGroupID_6_fieldID_2_numInSet_0, which has the following key values:


Where dropdown_num_2 is actually 'male', dropdown_num_3 is 'female'.

So the query to get all posts where gender is 'male' and ordered by year would need to check _simple_fields_fieldGroupID_6_fieldID_2_numInSet_N == 'dropdown_num_2' and ORDER BY the year of all matched posts.

  • @jaysonp - You show two sets of keys. Are there many sets of those keys? I'm trying to understand the 0 and 1 in numInSet_0 and numInSet_1. Are there many numInSet_N or just those two? Also, what are the values of those keys? Commented Dec 28, 2010 at 15:31
  • Hey Mike, I updated the post to help clarify.
    – jaysonp
    Commented Dec 28, 2010 at 22:47
  • Is that related to a specific plugin or have you coded that on your own? Do you have access to the underlying sourcecode? This looks like pretty individual problem to me.
    – hakre
    Commented Feb 6, 2011 at 16:26

1 Answer 1


Well, way late, but I found this looking for the answer myself before solving it, so I'll post for others in my boat, as I'm sure the OP sorted this by now. ;)

Use "meta_key" and "meta_value" in your query after taking a look at "post_meta" in your database to figure out what the simple fields plugin created, like the OP did above. The query I needed which is posted below grabs posts from 3 different post types (2 custom) where the simple field I added: "feature in homepage slider" has a dropdown value of yes (meta_value: dropdown_num_3).

        'numberposts' => '10', 
        'post_type' => array('filmp', 'corp', 'post'), 
        'meta_key' => '_simple_fields_fieldGroupID_1_fieldID_3_numInSet_0', 
        'meta_value' => 'dropdown_num_3'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.