Home › Forums › Front-end Issues › Reverse Relationship Query › Reply To: Reverse Relationship Query
No, not using a single WP_Query. This would not be possible even if the relationship field was on locations instead of doctors.
Using a standard WP_Query you would need to first get ALL doctors and loop through the posts and collect a list of all of the locations from them and then do another query to get the locations.
Even using standard WP custom fields this would be difficult due to what it is you’re looking to get.
There might be some ways to reduce the number of queries, or speed things up by using $wpdb https://codex.wordpress.org/Class_Reference/wpdb to directly query the database.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.