Support

Account

Home Forums ACF PRO Using compare IN operator for meta_query Reply To: Using compare IN operator for meta_query

  • You cannot use “IN” and must use “LIKE” as @acf-fan says and you need to have a nested query and do multiple “LIKE”s

    
    'meta_query' => array
      array(
        'relation' => 'OR',
        array(
          'key' => 'your-field',
          'value' => 'value 1',
          'compare' => 'LIKE'
        ),
        array(
          'key' => 'your-field',
          'value' => 'value 2',
          'compare' => 'LIKE'
        ),
        array(
          'key' => 'your-field',
          'value' => 'value 3',
          'compare' => 'LIKE'
        ),
      )
    )
    

    This can be costly to performance and it the list you are looking for is too long could even time out your site. This old post is about repeaters but it also applies in cases where ACF stores values as serialized arrays https://web.archive.org/web/20190814230622/https://acfextras.com/dont-query-repeaters/