WordPress Query – how can I return Case Studies featuring a particular Product – ACF Relationship Field

Currently developing a WP site and am using a few custom loops and queries, however this one has me stumped… I just can’t seem to wrap my head around the query that I will need.

Put simply, I have 2 custom post types, Case Studies and Products.

When entering a Case Study I have an ACF relationship field (filtered to just show a list of the product CPT) so I can select which products are used in that Case Study, I have outputted this list on the Case study post, which link to the individual product posts all fine..

However, what I am wanting to do, is kinda the reverse of this… and on say individual Product A post, display a list of 3 case studies that feature product A.

I could just add a relationship custom field to the product post and select the case studies I should list, but that seems a bit backwards. It makes more sense to add the products used on the case study posts (rather than add the case studies used to the product posts).

I think that all makes sense!? Any ideas how this could be achieved?

Thanks in advance

Read more here: WordPress Query – how can I return Case Studies featuring a particular Product – ACF Relationship Field

Leave a Reply

Your email address will not be published. Required fields are marked *