Forums

[resolved] Sharing information between sites. (3 posts)

  1. SethStevenson
    Member
    Posted 1 year ago #

    Is it possible to share data between sites? For example can I modify wp_query or query_posts to grab data from another site?

    A little extra info on what I'm trying to achieve:
    - I have a site with a custom post type called "Profile" and custom fields
    - I have a shortcode set up to display information from those profiles
    - I would like to be able to use those same shortcodes on all my sites but they need to be able to get data from the main site.

  2. Andrea_r
    team pirate
    Posted 1 year ago #

    You can use switch_to_blog to pull data from a particular site.

    Caveats:
    not so good on large sites
    will be replaced eventually

    If all blogs need to access the data... why not save it in a global table? (this would mean not using custom post types though)

  3. SethStevenson
    Member
    Posted 1 year ago #

    That worked perfectly, thanks for helping me again Andrea!

    Edit: To answer your question though, I want my editors to be able to edit the information in those custom post types easily so a global table wouldn't be ideal.

Topic Closed

This topic has been closed to new replies.

About this Topic