I'm trying to pass ACF field value in query as value. Let me show what I have now:
array(
'key' => 'office', // name of custom field
'value' => '320', // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
),
As you see, I have static value now, this is an ID of post object. The problem is that this is not always "320", so I've created another relationship to choose which office you want. But now I'm confused how to pass that field value into query. I tried something like this but it return all users from all offices
$valuee = get_field( "choose_office" );
$args = array(
'meta_query' => array(
array(
'key' => 'office', // name of custom field
'value' => $valuee, // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
),
),
);
$valuee
or is it a typo? And why do you useLIKE
as compare method, if you want only exact matches?