0

I have two sites that are both wordpress based but on separate servers. I would like the content of a specific page to be published in a format that can be included into another site's page. Basically I'd like to publish the page as some kind of a feed so another site can pull it in.

Example:

SiteA.com/about <- about is a static page. I would like to be able to access this as a feed or something (sitea.com/about/feed)

So that on another sites's page, SiteB.com/partners, can pull in the content from siteA. If SiteA updates the content, SiteB would be in sync.

Hope this makes sense. I have looked at custom rss feeds but I am not sure if that is the right way to do this. I've looked at quite a few plugins as well but wasn't able to find the right one.

I think the right approach would be to add a plugin to SiteA that lets me access that page's content as a feed but I'm open to ideas/thoughts.

Thank you,

  • 1
    The REST API is a more modern approach, but pulling in via RSS is also an option. Look into the fetch_feed function built into WP if you want to pursue the RSS path. Feeds are built into WP - see codex.wordpress.org/WordPress_Feeds - but the REST API is also now built into WP - see v2.wp-api.org – WebElaine Jun 6 '17 at 18:54
0

This is a good use case for the WP REST API. Site A's content is available through the API, so if you know the ID of the page you want to use, you can make a request for the content that way.

For example, if your About page has an ID of 2, then hitting https://sitea.com/wp-json/wp/v2/pages/2 would return a JSON object with the data for the page. If your page on Site B makes a request to Site A, gets the response, and displays it (without pulling it into Site B's database), then you'll always be getting the latest version of the content. There are some performance issues to look for, since you're making a remote request on every load, but it's possible to cache the response for a period of time and use the cached version to speed up the local page load.

I recommend reading through the REST API handbook for more details on how the API works and how to integrate it into a theme or plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.