---- COPY POSTS AND SELECTED PAGES PLUGIN ----
A WordPress plugin is required which can be installed on a standalone site AND/OR a multisite installation. The plugin would be installed on the mirror site and ensure that posts and selected pages are copied across from a designated source site to the mirror site in the following way.
-- PLUGIN SETTINGS: --
source_site_url - URL of the source WordPress installation.
page_ids - comma-separated list of page ids of the pages which should be copied to the mirror
post_count - number of posts to check at once (default: 3)
update_frequency_posts - how often to check the posts of the source site (minutes)
update_frequency_pages - how often to check the pages of the source site (minutes)
-- CREATE/UPDATE POSTS --
The plugin should check the recent posts up to a set maximum (provided as post_count in settings) of the source site via the site's WordPress REST API.
If a post DOES NOT exist on the mirror, create the post.
If a post DOES exist on the source site but has been modified, update the post on the mirror site accordingly.
-- CREATE/UPDATE SELECTED PAGES --
The plugin should check each of the selected pages (provided as page_ids in the settings) of the source site via WordPress REST API.
If the page DOES NOT exist on the mirror, do the following:
Firstly, check if the page on the source site has parents. If the page does have parents, and those parent pages do not already exist, create them. There is no need to update the parent pages if they already exist. This should work regardless of how many levels of parents a page has ([login to view URL], etc), to ensure that the relative path to the page on the mirror site is identical to the source site. Note: to ensure an identical relative path you may have to create the pages in order of hierarchy, for example: firstly the grandparent, then the parent, and finally the (child) page itself.
If the page DOES already exist on the source site but has been modified, update the page on the mirror site accordingly.
-- SHARE_URL CUSTOM FIELD CREATION --
When creating or updating a POST or PAGE page, if it does not already exist then create a custom field called share_url and give it the value of the link (url) of the original post or page on the source site.
-- NOTE ON HANDLING CATEGORIES AND TAGS --
When creating or updating a post, unless they already exist, the post's respective categories or tags should also be copied across to the mirror.
-- NOTE ON MEDIA HANDLING --
When creating or updating a POST or PAGE, unless already copied across, always ensure that all media is copied to the mirror and the respective URLs updated accordingly. This also applies to featured images.
-- NOTE ON UPDATING POSTS AND PAGES --
Before updating a POST or PAGE, check whether the POST or PAGE on the source site has been modified. Only update a page or post if it has been modified since the previous update or creation. Otherwise, do nothing.
-- MODIFIED DATE --
Unless another method is agreed upon, when a post or page is created or updated on the mirror site, its modified date should be set to that of its counterpart on the source site. This is to ensure that posts and pages are only updated when required.