WP_Query search by meta_key

2019-08-04 01:54发布

问题:

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

标签: php wordpress