Support

Account

Home Forums General Issues Query custom post based on user selections Reply To: Query custom post based on user selections

  • This will depend on what type of fields you’re using. I’m assuming that you’re using some type of field that’s stored as text, like a text field or a single select field.

    
    $args = array(
      'post_type' => 'salesperson',
      'meta_query' => array(
        'relation' => 'AND',
        array(
          'key' => 'country',
          'value' => $country
        ),
        array(
          'key' => 'state',
          'value' => $state
        ),
        array(
          'key' => 'industry',
          'value' => $industry
        )
      )
    );
    $query = new WP Query($args);