@hube2 This actually worked for me! I was able to get all products that have relationship to certain cars:
// Array of car IDs
$cars = [1, 2, 3];
$cars = array_map(function ($car_id) {
return [
'key' => 'cars',
'value' => '"' . $car_id . '"',
'compare' => 'LIKE',
];
}, $cars);
get_posts([
'numberposts' => -1,
'post_type' => 'product',
'meta_query' => [
'relation' => 'AND',
[
'relation' => 'OR',
...$cars,
],
]
]);
Thank you!
@hube2 Thanks for the response! The article gives an example of querying for (in my case) products by a single car ID. What I want is querying by multiple car IDs. Is this just not possible with ACF relationships?