I would like to query my posts by filtering for a custom meta added with Advanced Custom Fields. It's a boolean meta, so every post will have something like:
{ ..."acf" : {"highlight" : true } ...}
I'm not able to filter by this meta value, even if I exposed meta_key and meta_value to the REST API in function.php
:
function my_add_meta_vars ($current_vars) { $current_vars = array_merge ($current_vars, array ('meta_key', 'meta_value')); return $current_vars;}add_filter ('rest_query_vars', 'my_add_meta_vars');
But if I try:
GEThttp://localhost/wp-json/wp/v2/posts?filter[meta_key]=highlight&filter[meta_value]=true
I see all the posts as if the filter is ignored.