I'm using the ACF relationship field to display related blog posts on each product. Currently it works but I have to check each product manually to show a related post on it.
$posts = get_posts(array(
'meta_query' => array(
array(
'key' => 'products', // name of custom field
'value' => '"' . $product->get_id() . '"',
'compare' => 'LIKE'
)
)
));
Issue: How could I add product categories instead so I wouldn't need to add manually 200 products but only one product category that has this post as related and will show the post under single view.
Possible solution?
Can this be integrated with the taxonomy ACF field instead (if post has taxonomy product_cat as related it will show under products in that category)? Unfortunately unable to think of a way