WordPress / API IntegrationOctober 2016

Variety.org.au – WordPress REST API Multi-Site Sync

Developed a REST API–based synchronization system for Variety.org.au, enabling real-time content sync between a national site and multiple state sites. Replaced unreliable XML/cron-based transfers with API-driven automation using custom plugins.

Technologies Used

WordPressREST APIPHPMySQLAdvanced Custom Fields (ACF)JSONCSS
Variety.org.au – WordPress REST API Multi-Site Sync

Project Gallery

Variety.org.au – WordPress REST API Multi-Site Sync screenshot 1
Variety.org.au – WordPress REST API Multi-Site Sync screenshot 2

Project Metrics

Architecture

National–to–State multi-site content replication via REST API

Performance

Reduced sync latency from scheduled cron to instant updates

Reliability

Eliminated XML transport failures

Scalability

Supports multiple state sites pulling from a single national source

Maintainability

Two-plugin architecture for master/slave separation

Challenges

  • Existing XML-based data sync via cron jobs failed frequently and lacked reliability
  • Needed real-time post updates from the national site to all state (slave) sites
  • Custom fields (ACF) used different internal reference keys on each site
  • WordPress REST API by default excluded metadata and attachments
  • Required method to sync large image libraries via REST endpoints

Solutions

  • Developed two custom WordPress plugins — one for the master (national) site and one for the state (slave) sites
  • Added a **“Sync Post”** button to post edit screens to trigger immediate API pushes
  • Customized the WordPress REST API endpoints to include metadata and attachment data inline with post payloads
  • Implemented logic to detect new vs. existing posts and update only national content fields while preserving local edits
  • Created an image replication method that automatically generates ‘attachment’ post types and updates URLs dynamically
  • Mapped ACF reference keys between environments, preserving custom field integrity across all sites

Results

  • Reliable national-to-state content synchronization in real time
  • Zero XML transport or cron-job failures after implementation
  • Preserved state-level local edits without overwriting
  • Reduced sync complexity to a single API call per post
  • Enabled scalable, future-proof multi-site content distribution architecture

Project Overview

The agency Follow contracted Anton to engineer a data synchronization system between the national Variety.org.au website and multiple state subsites across Australia.
Previously, content updates relied on XML files and cron jobs, which frequently failed or lost data. The new system leveraged the WordPress REST API, enabling immediate, reliable, and selective content distribution between sites.


API-Driven Multi-Site Architecture

Each state site acted as a “slave” instance, while the national site served as the “master.”
Anton built two custom WordPress plugins:

  • Master plugin (national site): added a “Sync Post” button above the post update area, allowing editors to push updated content to all state sites in real time.
  • Slave plugin (state sites): received API requests, validated post existence, and updated only national fields while keeping local state-specific content intact.

REST API Customization

WordPress’s default REST API responses exclude metadata and attachments.
Anton extended the /wp-json/wp/v2/posts endpoint to:

  • Include custom metadata and ACF field values
  • Return image data (attachments) within a single API call
  • Map and maintain ACF field references so each state site retained full ACF compatibility

This dramatically reduced network requests and ensured consistent data structure across all sites.


Image & Media Replication

WordPress manages images as “attachment” post types rather than raw files.
The solution:

  • Queried each image’s metadata from the master site
  • Verified if the image already existed on the state site
  • If not, created a new attachment entry, downloaded the image, stored it in the uploads folder, and linked it to the relevant post

This ensured all featured images and content media were synchronized without duplication or corruption.


Technical Highlights

  • Instant API-triggered synchronization
  • Custom endpoint enhancements for metadata and media
  • Dual-plugin system for role separation
  • Failsafe ACF mapping to prevent reference conflicts
  • Local field protection (state content preserved)

Outcome

The final system empowered Variety.org.au’s editors to push updates across the network instantly, replacing unreliable cron-based data migration with a robust REST-API solution.
All state sites now stay perfectly aligned with national content, while still allowing local variations — a model that remains scalable for future site additions.


Reflection

This project was an early example of headless API engineering within the WordPress ecosystem — proving that custom REST endpoints could rival enterprise-grade content delivery systems.
It established a reliable framework for multi-site data distribution, still relevant in modern decoupled architectures.

Ready to Build Something Amazing?

Let's discuss how we can transform your ideas into powerful software solutions.