I tried to make a Advanced search form with acf fields and use this query
if( isset( $_POST['antivirus_threat'] ) && $_POST['antivirus_threat'] == 'on' )
$antivirus_filter_args['meta_query'][] = array(
'key' => 'antivirus_featured_threat',
'value' => 'myitems1',
'compare' => 'LIKE'
);
Group field is: antivirus
Checkbox field is: featured_threat
items in checkbox : myitems1, myitems2, myitems3, myitems4
value => array() not worked with ‘LIKE’ in meta_query
i need to set multiple value of my query because my query take a long time to load posts
Thanks for any help
I don’t see anything wrong with the query based on the information you’ve given for getting posts with one of the values. If you want to do mulitple values at the same time then you have to do
if( isset( $_POST['antivirus_threat'] ) && $_POST['antivirus_threat'] == 'on' )
$antivirus_filter_args['meta_query'] = array(
'relation' = 'OR,
array(
'key' => 'antivirus_featured_threat',
'value' => 'myitems1',
'compare' => 'LIKE'
),array(
'key' => 'antivirus_featured_threat',
'value' => 'myitems2',
'compare' => 'LIKE'
));