Support

Account

Home Forums Feature Requests Query by dropdown field label Reply To: Query by dropdown field label

  • Hi @ageibert

    I believe you can get the label and value pairs with the get_field_object() function. So you can do it like this:

    $the_input = '12'; // The input from users
    
    // Get the select field object
    $select_object = get_field_object('select_field_name');
    
    // Search the field value based on the label
    $userInput = array_search($the_input, $select_object['choices']);
    
    print_r($userInput);

    I hope this helps 🙂