0

I'm looking for an easy/efficient way to manage & serve content from one master WP site to multiple drones (NOT multisite).

On the master site i'll have custom post type "served_content". The drones will have "collection" pages, each will serve multiple different served_content posts. served_content might become disabled from the master site, too.

Requirements

  • Fetch posts with their metadata
  • Cache this data so we don't slow down page load too much. Ideally instead of requesting everytime, it can just sync the "served_content" posts across all my WP installations
  • Use mostly native WP functions, or readymade WP plugins
  • Being able to publish and un-publish (disable from showing) the served-content, right from the master site.

How I want it to work

On (one of) my clients i'll have a page that requests specific post IDs from the centralized location, for example:

$posts_to_retrieve = array(1,5,12,23);
get_remote_posts($posts_to_retrieve);

What I've been planning on using

  • WP XML-RPC api (and specifically wp.getPost method)
  • SimpleXML to parse the returned XML

The problem is I don't think XML-RPC method is caching the requests

What will you recommend to use?

Thanks in advance!

2
  • 1
    "I don't think XML-RPC method is caching the requests". I don't think it should. If you're caching the responses on your "drone" sites, then you needn't worry about it - they'll only "ping" the master site once every X hours (however long you decide to cache the response for). Commented Jun 9, 2014 at 11:05
  • So yuo're saying I should just use XML-RPC and some caching plugin (e.g. W3 Total Cache)?
    – Lulu
    Commented Jun 9, 2014 at 15:08

1 Answer 1

0

On your master site, register a new XML RPC method that accepts a date argument and replies back with all content published since then.

For each of your drone sites, register a cron hook that pings the master every X minutes/hours with the date of the most recently "imported" content, and then saves the response locally.

W3 Total Cache (and the like) are front-end cache systems for serving up content to your users. In this context, caching is referring to storing content on the drone site for a period of time, and then updating at regular intervals, as opposed to pinging the master on every front-end request.

4
  • Thanks for the asnwer! How does the drone site imports the data? Will it create it in the wp_post table? Also, What happens if one of the original posts that was imported, was unpublished in the master site? The content may be published and un-published anytime - so this is something to take into account (I've added this req to the original questions, sorry I didn't mention it before)
    – Lulu
    Commented Jun 9, 2014 at 16:23
  • Yes, I'd create the posts in wp_posts so that they behave in the same way on the drone site. Your second question is a bit beyond the scope of WPSE - I can help steer you in the right direction, but I can't code it for you! Commented Jun 9, 2014 at 18:30
  • You're right, I did some homework (post_status is the answer to my second question), so please let me be more specific :) : since posts ids can't be synced between the setups, I need to find a way to put a reference to the original id in the master site. I'm thinking of using the guid field for that purpose, is that a good idea? Or maybe a custom field? Any suggestion?
    – Lulu
    Commented Jun 10, 2014 at 0:18
  • I would use a custom (meta) field. Commented Jun 10, 2014 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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