I have a query inside a function that is returning matches that i don't want, for example when the $id=116 it is also returning results where the meta_key 'funds_id' is 11687.
public function list_related_docs($id){
$docs_args = array(
'post_type' => 'publication',
'post_status' => 'publish',
'posts_per_page'=> -1,
'orderby' => 'meta_value_num title',
'order' => 'ASC',
'meta_key' => 'fund_list_order',
'limit' => 4,
'suppress_filters' => 0,
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'funds_id',
'value' => $id,
'compare' => 'LIKE'
),
array(
'key' => 'fund_list_order',
'compare' => 'EXISTS',
)
)
);
$docs_posts = get_posts($docs_args);
// more stuff
}
I've tried using 'compare' => '=' , but that doesn't return any results.
Thanks.
'compare' => 'LIKE'
, note that 116 is 'like' 11687 as in they are similar