I have a custom query function using ACF meta which looks like this:
// WP_Query arguments
$args = array (
'post_type' => 'staff',
'post_status' => 'publish',
'tax_query' => array(
'taxonomy' => 'team',
'field' => 'slug',
'terms' => 'sales-representatives'
'meta_key' => 'state',
'meta_value' => $state_query
Where $state_query is an argument for the function, for example “QLD”.
This works perfect, however some of my posts have multiple values. I took a look in phpmyadmin and this is what they look like:
So I can see it looks like an array.
Is there a way to change the query logic so that it uses a LIKE compare?
I tried adding this:
'meta_query' => array(
'key' => 'state', // name of custom field
'value' => $state_query, // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
But it didnt work – any ideas?