1

I have a meta field with a1, a2, a11 values, etc. I do search by this code

array(
'key' => 'a',
'value' => 'a1',
'compare' => 'LIKE'
),

But there was a problem, LIKE does not exact search and coincidence. at a1 value records with the field a11 are also displayed. How it is possible to correct it that search was precisely on a1 to value?

'value' => 'a1',
'compare' => '='

And

'value' => array('a1'),
'compare' => 'IN'

don't work. nothing is displayed

Reynold
  • 41
  • 3
  • `'compare' => '='` should work fine. If it doesn’t, then I’d first of all suspect that your meta value is not actually exactly `a1`, so go check that for any leading/trailing white space characters (or check the length of the value, which should be 2.) – CBroe Jun 21 '17 at 11:36
  • 'value' =>array('a1'), 'compare' => '=' try this – Shefali Jun 21 '17 at 11:40
  • I use advanced custom fields pro a plugin, and meta fields are filled through him. I have a meta-field "a" which by means of input select of the field can be filled with MULTIPLIE values. for example post have the field "a" has the "Array array ([0] => a1 [1] => a6)". I have checked it through get_post_meta() function. how to me to use "="? its doesn't work, result - 0 finded posts. works only with "LIKE" – Reynold Jun 21 '17 at 13:29

0 Answers0