Support

Account

Home Forums General Issues Reverse queries with Relationship field

Solved

Reverse queries with Relationship field

  • Hi guys,
    I was wondering if it’s possible to create a two dimensional query.
    To illustrate my point,
    i will give you an exemple based on this tutorial
    http://www.advancedcustomfields.com/resources/querying-relationship-fields/

    Imagine I want to be able to display all existing offices for each locations, for each doctors.
    Each office is connected to a location through a relationship field called “location” and the location is connected to the doctor through a field called “doctor”.

    I don’t manage to do that, maybe I think that the problem is how to set the value ID for the second get_posts type request.

    If anyone have any idea, it will be very useful to me.
    Kinds regards,

    Damien

  • Ok guys,
    I’ve managed to do that by make another get_posts query and by replacing ‘get_the_ID’ by a var $doctors_ID equals to :
    $doctors_ID = $doctor->ID;

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Reverse queries with Relationship field’ is closed to new replies.