Forums

Posts 2 Posts
Related posts showing multiple times (3 posts)

  1. tamlyn
    Member
    Posted 1 year ago #

    I've got a reciprocal many-to-many connection between news stories and programmes and I'm using get_related to show related news stories on the programme pages but also on the news pages (i.e. other news related to the same programmes).

    It works great except that news stories which are connected to two programmes are returned twice in the query. I presumably that's because it sees them as being related in two different ways - once via each programme.

    e.g. for these connections:

    Story 1 - Programme A
    Story 1 - Programme B
    Story 2 - Programme A
    Story 2 - Programme B

    get_related() on story 2 returns story 1 twice and on story 1 returns story 2 twice.

    Any ideas how I can resolve this?

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    I don't know; there might be cases where you don't want to squash the duplicates.

  3. tamlyn
    Member
    Posted 1 year ago #

    OK, I guess I can always put the posts into an array and dedupe them at the end.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic