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 to directly query the database.