Support

Account

Home Forums General Issues Query relational data

Solving

Query relational data

  • Hi there people 🙂

    I have a need to make somwhat of a parent relationalship query and can’t figure out how to do this….

    I have a custom post type A
    And another custom post type B

    In postype A there is an ACF that is an object field and is targeting post type B

    Now when postype A is viewed I want it to list out all those from from post B where post type A is selcted…. So how can this be achieved? can anyone point me in the right direction 🙂

    So something like

    post A1, A2, A3 is selcted in posttype B1

    And now when viewing B1 I wan’t a list showing A1, A2, A3 (need only title and permalink)

  • Ohh and by the way, I know there is a ACF relational field I can set up. But tried that, and seems like I have to go into Post type A and manually select the post type B’s to be in there… And kinda not an option cause then I would have to go through hrundreds of post type Aøs and for each go though hundreds of post type B to check in whicj one they are selected, pretty much an imposibble job to do

  • You can either use a bidirectional field (there are code examples and plugins available) or you can do a reverse relationship query as explained here.

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

You must be logged in to reply to this topic.