Support » Fixing WordPress » How to reference user posts in other multisites

  • thelaw


    I was wondering how I might be able to call the posts by a user from another multisite. For example, user joesmith wrote posts in the cars site and also in the sports site. I’d like to have a page in each site that lists all the posts by joesmith such as:

    joesmith wrote these articles

    cars site
    1. Porsche is great
    2. Love that Chevy

    sports site
    1. Love football
    2. Playing golf

    There may not be an easy way but I’m wondering if there are calls to other sites like global calls. The only other thought I had that was “easier” was using rss to grab posts by a user – not sure how that might work either.

Viewing 3 replies - 1 through 3 (of 3 total)
  • bhenselmann


    I´m looking exactly for the same thing!

    I thought on trying to do something with switch_to_blog but maybe there is a better way?

    Moderator keesiemeijer



    maybe there is a better way

    No, use switch_to_blog(), do the query and then restore back using restore_current_blog()



    keesiemeijer – super!!! Thanks. This is what I was looking for. It’s strange that you need to do this in the same database but the concept is sound and the same as switching databases in mysql. Thanks much.

    Ideally there would be a way to have calls to all other multisites in one shot but, when I think about it, the only way to do this efficiently would be to have an index in a table of items from all other multisites or else it can get messy.

    Thanks a lot for pointing me in the right direction! 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to reference user posts in other multisites’ is closed to new replies.