How to Publish to Multiple WordPress Sites from a Single Install

How would you like to be able to publish to as many different WordPress sites as you liked from a single install? So you only need one configured install of editflow and one set of plugins (listed below)  together with one place to login and manage your content.

feature

Welcome to the WordPress Content Hub – a solution for push syndicating content to any WordPress install, be it multisite or on WordPress.com… let’s get publishing!

Hub and Spokes

All content management systems, from the simplest blogging platforms to the most complicated enterprise-level applications perform two major tasks: content management, providing the tools to create, review and ultimately publish content; and, content delivery, actually putting that content into the hands of users.

Splitting the content management and delivery functions
Splitting the content management and delivery functions

The Content Hub splits out those two functions using a “hub and spoke” model. The Hub is a single WordPress site dedicated to content management which pushes content to one or more Spokes that handle the content delivery.

There are a number of reasons why you might opt for a Content Hub:

  1. You have separate sites for mobile and / or tablet visitors
  2. You manage a network of sites within a niche and you often cross-post content
  3. You have a team of authors that write content for any part of your network
  4. You have a tried and tested suite of admin plugins driving your publishing process that you currently have to install and maintain on every new site you launch
  5. You want a “staging” site – somewhere outside of the live site where content can be created, reviewed and tested

Benefits of the Hub and Spokes model

Single location for content management

With a Content Hub, all your content is managed in a single spot. Not only does that make it easier to manage your user accounts but publishing content to multiple sites and to your social media sites is a breeze.

Simpler WordPress installs

No longer do you need to install that potentially conflicting mix of admin and front-end plugins. The Hub needs only the plugins required to create and manage content; the Spokes only need the plugins and themes required to deliver the content. The end result is leaner and easier to maintain WordPress sites.

Security

With no requirement for public access, the Hub can be tightly locked down. You can restrict the entire site to logged-in users only, only allow access from specified IP address and put the entire site under SSL. You can even host the Hub locally so long as it has a pathway out to the internet.

Push to multiple sites in single action. Delete too!

Push a post to multiple sites by simply clicking a few checkboxes. No more cutting-and-pasting from one site to another. And move the post to the Hub’s trash and it’ll be trashed on all the Spokes too.

Publish to social media

Set-up one of the many social posting plugins in the Hub and publishing to social media accounts is also centralised.

Using a CDN for images and attachments

A CDN will vastly improve your hub
A CDN will vastly improve your hub

In the Hub and Spoke model, images and other attachments are not pushed to each Spoke’s environment – it’s needless duplication. By default, all the network’s images, video, audio and documents are uploaded to and served from the Content Hub which, depending on the number and size of files, may stress your Content Hub’s hosting platform. It also means that you will not be able to host your Content Hub locally.

To maintain maximum flexibility and reliability, improve backup and recovery and to generally make your Hub and Spokes easier to manage, you should use a content delivery / distribution network (CDN) to host your non-HTML assets.

Setting up a CDN is outside the scope of this article but Sufyan bin Uzayr has everything you need to know about WordPress and CDNs.

A quick word about APIs

There are two APIs that can power the Hub and Spoke approach: the XML-RPC API and the JSON-based REST API. XML-RPC is supported out-of-the-box by self-hosted and WordPress.com sites. REST API is built into WordPress.com but self-hosted sites will need to install either JetPack or an experimental plugin.

The XML-RPC API is the simplest to use and so that’s what we are going to use here. If you’d prefer to use the REST API, then there’s good documentation on how to set it up in the official plugin repository. Remember, that in order to use the REST API you must create an application in WordPress.com and it must be able to see the Hub which will prevent you from hosting it locally.

Setting up the Hub

1. Select your Hub site

Whilst you can utilise an existing site, it’s better to create a clean WordPress install for the hub. If you want to seed the Hub with existing content then you can always import the content from existing sites using WordPress’ Import Tool.

2. Install and configure the Push Syndication plugin

Push syndication is the key plugin that performs the pushing of content to the Spokes. Once installed, configure the plugins at Settings > Push Syndicate Settings.

The Push Syndication plugin's settings page
The Push Syndication plugin’s settings page

Select the post types you want to syndicate (don’t select attachment) and check the option to Delete Pushed Posts.

The API Token Configuration is only required when using the REST API so you can ignore that.

Once installed, you need to add the syndication key to your Hub’s wp-config file. Open the file in your favourite editor and add this line somewhere above the famous /* That’s all, stop editing! Happy blogging. */ line.

{code type=php}define(‘PUSH_SYNDICATION_KEY’, ‘put-your-unqiue-syndication-key-here’);{/code}

3. Create Site Groups

The Push Syndication plugin pushes content to selected Site Groups. How you group your sites depends on your needs but unless you have two sites that are very similar, it is likely that each group will only contain one site.

Site Groups are created via the Sites option in the main Admin menu.

4. Set the Permalink structure

To make sure that internal links will work, there are two requirements when it comes to setting the Permalink structure:

  1. Do not use IDs! These will be different between your Hub and your Spokes. Any links containing IDs will likely give unintended results
  2. Be consistent! The Hub and all your Spokes must use the same permalink structure. If any of your Spokes are on WordPress.com structure then you must use the WordPress.com default of Day and name.

5. Create a category structure

How you structure the categories in your Hub will depend on how many Spokes you have, how many categories appear in multiple sites and your personal preference.

The key points to remember are:

  1. The push syndication process uses category names so these need to be the same in the Hub as they are in the Spokes
  2. Hierarchy doesn’t matter
  3. If a Spoke cannot find a matching category, then it will create one.
  4. Additional categories with the same name are ignored
  5. This is only about organisation – the categories do not control syndication

You have three main choices, then, for setting up your category hierarchy. To illustrate, let’s assume you have a network of three Spokes, one a generic site about all things WordPress, one a site specifically for BuddyPress and one a site specifically for Multisite.

Option 1

Screenshot of WordPress category page showing replicated site category structure
The first option is to create top level categories for each Spoke (in this example, BuddyPress, Multisite and WordPress) and then recreate each Spoke’s individual category structure underneath it’s top level category.This approach makes it very easy to determine the intended destination of the content but can result in the duplication of categories as can be seen with the multiple entries of News, Plugins and Themes. However, assigning a post with multiple categories of the same name does not cause any issues with the push syndication process.This approach can become unwieldy if the Spokes have extensive category structures. 

Option 2

mage of WordPress category screen showing a simplified structure with common categories grouped and only unique categories under the specific site
The second option groups all the common categories together and only creates a top-level category for those Spokes that have unique categories. In our example, News, Plugins and Themes appear in multiple Spokes and so these categories are grouped under Common.The WordPress Spoke has the unique categories Hosting, Opinion and Reviews and so these are created as a separate structure.This makes for a much smaller and more manageable structure. 

Option 3

Image showing a WordPress Category screen with all Spoke references removed
The third option is to remove references to the Spokes altogether and work with a consolidated structure. This will produce the shortest structure, six categories compared to fifteen in Option 1, and the easiest to manage.This approach is best suited to networks where Spokes have a similar structure. 

Optional plugins

That’s all you really need to create your Hub but there are some additional plugins that you might want to consider to improve your content management processes:

ABT Relative URLs

By default, the WordPress WYSIWYG editor inserts absolute URLs into content for links to other posts and pages and for media files. This will cause all links in the Spokes to point back to the Hub rather than to the same content in the Spoke. The ABT Relative URLs plugin solves that problem by converting all local absolute links to relative links. Only use this plugin if you are using a CDN for your media files otherwise they will also all get converted.

Restricted Site Access

As mentioned previously, one advantage of splitting the functions of a content management system is that you can fully lock-down the Hub. The Restricted Site Access plugin can limit access to the Hub to logged-in users only or restrict access to specified IP addresses.

Category Checklist Tree

Screen-grab showing the category listing from the Edit Post screen
Categories stay “in place”.

When populating the Categories metabox on the post edit screen, WordPress’ default behaviour is to put any categories assigned to the post at the top of the list. The Category Checklist Tree plugin overrides this behaviour and instead highlights the categories within the category structure.

This is invaluable if you decide to use a category structure with Spokes at the top-level.

Editflow

The ultimate tool in planning your content. In a traditional install it can clutter the interface but it fits well in a content management focussed Hub. Again, Sufyan has more on Editflow in his article Five Free WordPress Plugins to Manage a Multi-Author Site with Ease.

Adding Spokes to your Network

For self-hosted sites we just need to complete a couple of minor preliminary tasks.

  1. Create a new user with the Editor role. This is the user that the Hub will use when pushing the content and so it has to have full publishing rights. Don’t forget, this user will appear as the Author if your theme is outputting author information in the post meta, so ensure that you give it a suitable name.
  2. Ensure that the permalinks are set up with the same structure as the Hub (most likely Day and name).

Adding a site in the Hub

  1. Go to the Hub dashboard and click on Sites in the Admin menu.
  2. Click on Add a site. Enter a title for the site; select WordPress XMLRPC as the transport type; enter the root URL for your site; enter the username and password for the Editor role (or the appropriate WordPress.com user); check enable; check the appropriate Site Group; and, click on Add Site. You can click on Add New Site Group if you need to create a new site group.

The plugin will attempt to contact the site using the URL, username and password. If all is good then you’ll get a confirmation message that everything is okay.

Screenshot showing the Push Syndication Add A Site screen
Adding a site. Don’t forget to assign a Site Group!

Repeat this for all your sites.

Syndicating content

Now that you’ve set up your Hub and Spokes, we can finally get to the exciting part: actually syndicating content!

In the Content Hub, open the Add New Post screen and create a post as you would do normally. As post formats, featured images, custom fields and authors are not supported by push syndication process, you may as well tidy up the interface and uncheck these items in the Screen Options pulldown.

Keep in mind that:

  • The Author will be the user you entered when you added the site to the Hub
  • All images and attachments must be embedded – if you are using a CDN then they will be served from there, if not they will be served from the Content Hub (this will also dictate whether you host the Hub locally or not).
  • All internal links must be relative so that they work correctly on the Spokes rather than pointing back to the Hub. If you are using a CDN then you can do this automatically by installing the ABT Relative URLs plugin. Otherwise you’ll need to update the URLs manually before publishing.
  • The category will be created in the Spoke if it does not already exist
  • Tags are pushed to the Spokes
Screenshot showing the list of site groups in the Syndicate metabox
Selecting the site groups that you want to push this post to. Using a 1-to-1 group to site relationship.

Once you have finished drafting your post, you need to select the Site Groups in the Syndicate metabox that you want the content pushed to.

Click Save Draft then click Publish. Sometimes posts are not always pushed if not saved first. If you have author-editor publishing model then the save will happen anyway as part of your process; if you don’t then it’s probably well worth getting into the good habit of using at least a two-step publishing process.

Okay, now go check your Spokes! Your syndicated content should now be there!

Deleting content

An added bonus with the Push Syndication plugin is that it handles deletion of posts as well, so long as you activated support of this feature in the plugin’s settings page. Simply trash a post and it will be removed from the relevant Spokes.

In fact, you will need to trash a post to remove it from a Spoke as simply unchecking it in the Syndicate metabox seems to have no effect. To remove a post from a single Spoke you’ll need to:

  1. Uncheck the appropriate Site Group
  2. Update the post and then trash it (this will remove it from all Spokes)
  3. Go to Trash and restore it.
  4. Update it (this will push it out to the remaining checked Site Groups)

Further considerations

Extending the Push Syndication plugin

Providing more sophisticated push syndication requires significant upgrades.
Providing more sophisticated push syndication requires significant upgrades.

The Push Syndication plugin has been built to provide a one-way, one-time interaction with the WordPress APIs and so its capabilities are fairly basic.

To provide more sophisticated push syndication that caters for featured images, authors and custom fields (and therefore true custom post type support) requires significant upgrades to allow for two-way, multiple interactions.

For example, to be able to set the author to something other than the Editor, requires the Hub to first ask the Spoke for a list of its authors so it can use the Spoke’s author ID in the push process. Supporting custom fields requires the Hub to get a list of the custom fields from the Spoke so that it can use each field’s unique ID in the push process.

Non-WordPress Spokes or even non-WordPress Hub

The real flexibility of the Hub and Spokes model becomes apparent when you start to consider Spokes and even a Hub that are not hosted on WordPress.

Any application that can implement the WordPress API can act as a Spoke and any application that can talk to the API can be the Hub. This means that you can mix and match your applications, swapping the Hub and Spoke platforms without impacting on the rest of your network.

If you’d prefer to use Drupal for content management, or a custom web app, that’s fine, so long so long as they can talk to the WordPress API.

Pulling rather pushing

Just like any WordPress site, the Content Hub supports the WordPress XML-RPC API and, via a plugin, will support the REST API so content doesn’t have to be pushed by the Hub, it can also be pulled by the Spoke.

Content can also be pulled by the Spoke.
Content can also be pulled by the Spoke.

The most likely scenario for pulling is a Spoke that is an application such as an HTML5 web app or an app running on a tablet or smartphone. The app makes use of the Hub’s API to pull new content down to the device. It’s even possible that it may use the Hub (or possibly a dedicated Spoke) for managing memberships and subscriptions.

The Push Syndication plugin may have its limitations but when combined with a CDN, it provides an easy and efficient method for managing the content for multiple sites from a single WordPress install.

If your sites are using the standard post types and you don’t mind using a single author, perhaps you should be considering setting up your own Content Hub?

photo credit: bailey weaver, toffehoff