Support » Plugin: Simple Fields » WP_Query and dropdowns

  • Resolved kingzjester

    (@kingzjester)


    I have a WP_Query that filters by a field that was defined through a dropdown—but the meta value for it is actually ‘dropdown_num_9’ or whatever, not the actual dropdown value, so this meta_query fails to find anything:

    'meta_query' => array(array(
      'key'     => '_simple_fields_fieldGroupID_3_fieldID_6_numInSet_0',
      'compare' => '=',
      'value'   => $category
    ))

    What is the best way to ask the simple-fields for all the dropdown values and keys ahead of time so that I can bake the WP_Query to look for the pre-baked key values and bypass this grief?

    http://wordpress.org/extend/plugins/simple-fields/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor eskapism

    (@eskapism)

    This code would work as a start I think:

    global $sf;
    $field = $sf->get_field_by_slug($field_slug = "", $fieldgroup_slug = "");
    print_r($field);

    Then check how the $field-array is constructed and you can figure out how to get the value for the dropdown.

    Is seems wild that there is no simple way to ask for the actual dropdown value. The lack of ability to get to the dropdown and radio values was questioned years back, and people started hammering in the code itself to get it working.

    It seems irrational.

    Plugin Contributor eskapism

    (@eskapism)

    You can add this as a feature request over at github:
    https://github.com/bonny/WordPress-Simple-Fields

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP_Query and dropdowns’ is closed to new replies.