Support

Account

Home Forums ACF PRO Bidirectional relationship for selected posts

Unread

Bidirectional relationship for selected posts

  • I use the code of this tutorial Bidirectional Relationships to connect related posts of the same custom post type. The code updates the relationship field of the current post with all the selected posts and the relationship field of the selected posts with the current post. What I’d like it to do is to update the relationship of the current post with the selected posts as it does and the relationship field of the selected posts with all the selected posts as well. Is this possible if I try to query the selected posts inside the tutorial’s function code and update the relationship field with the selected posts array for all posts selected? Has anyone tried this?

    Example with the current function:
    Current Post: Post 1
    Related Posts: Post 2, Post 3, Post 4, Post 5

    Post 2
    Related Posts: Post 1


    Post 5
    Related Posts: Post 1

    Example with what I’d like it to do:
    Current Post: Post 1
    Related Posts: Post 2, Post 3, Post 4, Post 5

    Post 2
    Related Posts: Post 1, Post 3, Post 4, Post 5


    Post 5
    Related Posts: Post 1, Post 2, Post 3, Post 4

Viewing 1 post (of 1 total)

The topic ‘Bidirectional relationship for selected posts’ is closed to new replies.