I have 2 acf custom post type
- target_crop
- product
Plugins that I am using: Custom Post Type UI, Advanced Custom Fields and ACF to REST API
target_crop: There is one field call target_crop(text)
product: There are 3 fields product_name(text), technical_composition(text), target_crop(post_object->ref to target_crop)
When I hit {{url}}/target_crop I get this below response from the ACF to Rest API which is fine.
And when I hit {{url}}/product I get this below response
Now what I want is I want to add a filter like {{url}}product?target_crop=Rice so it will only show the data for that target_crop.
I have tried adding meta query
if(isset($_GET['target_crop']) && !empty($_GET['target_crop'])){
$meta_query['meta_query'][] = [
'key' => 'target_crop',
'value' => $_GET['target_crop'],
'compare' => 'LIKE'
];
}
But it is not showing anything at all.
On the other hand instead of {{url}}product?target_crop=Rice if I add {{url}}product?target_crop=70 70 which is the id for rice then it showing perfectly fine.
I want to query post based on post object sub field but not the id.

