Support

Account

Home Forums General Issues Querying by relationship field Reply To: Querying by relationship field

  • Yes, you need to add a nested query with multiple values

    
    'meta_query' => array(
      'relation' => 'AND',
      array(
        'relation' => 'OR',
        array(
          'key' => 'car',
          'value' => '"1"',
          'compare' => 'LIKE'
        ),
        array(
          'key' => 'car',
          'value' => '"2"',
          'compare' => 'LIKE'
        ),
        array(
          'key' => 'car',
          'value' => '"3"',
          'compare' => 'LIKE'
        )
      )
    )
    

    The reason for the nested meta query is that if you also want to search by something else and the each thing you are searching by is in its own query.