Query for ACF relation


to describe what I want to achieve I’ll refer to the DALE example from @T-low.

So I have a CPT for Doctors and Locations. For the locations I also set up an ACF relation field. There I can chose the doctors that are related to the location.

On the post page of the locations I want to display the related doctors. So I set up a query with “Include Posts > My ACF relation”. This works fine so far.

Now to my problem

I also want to display the related locations on the doctors page. How can I set a query so that only the locations are shown where the current doctor was selected in the ACF relation field?

Can anyone help me out here?

Hi @Jonas,

As explained in the ACF examples available at: ACF | Querying relationship fields

You’ll want to set up a new meta query in the Query editor and set the meta key to the name of the ACF Relationship field. Then set the meta value to Post ID and compare to LIKE.


Hi @Louis,

thank you so much! I missed the “LIKE” part. Now it works :confetti_ball: :champagne: