A failed sync is content that should not have moved, content that arrived mangled, or a conflict resolved by choosing the wrong side. All three are recoverable. None are recovered by pressing Sync again without a plan.
Work in this order: stop the process, read the history, then restore. Git is the record. The local base is what tells each site what it last agreed to, and misunderstanding it is how a recovery becomes a second incident.
1. Stop automatic sync
Every connected site is a peer and can pull the bad content on its next cron run. Uncheck Automatic sync on each site that matters, starting with the one that made the change, before you open Git.
Removing the token is not the same thing. A site counts as configured with or without a token, so the 15-minute schedule keeps firing and failing. The dialog says “Sync stops until a new token is added.” It means Sync cannot succeed, not that the timer is paused. Uncheck the box.
A run may be in flight. The lock goes stale after 600 seconds. If you get A sync is already running. Give it a moment, then try again., wait.
2. Find the commit
Clone the repository somewhere quiet. Each sync makes one commit on the content branch containing documents, attachment records and this site’s environment record. Media is committed separately on <branch>-media.
git log --oneline -20
The default message is Sync from <site>. If someone filtered staticscope_sync_commit_message, it tells you less. Compare timestamps with the Sync screen’s Last synced.
To see what a commit touched:
git show --stat <sha>
git show <sha>:items/<uuid>.json
To follow one post, get its Sync ID and then its file history:
wp post meta get 123 _staticscope_sync_id
git log --oneline -- items/<uuid>.json
A commit containing only environments/ means the fingerprint changed, not the content. Ignore it; the next sync writes a fresh one.
3. Decide what is wrong
| What you see | Where the fault is | What to restore |
|---|---|---|
| The same wrong text on every site | A bad document was pushed | That document in the repository. |
| One site wrong, the others right | A local import, or a resolution made on that site | Probably nothing in Git. Compare before you revert. |
| An image is the wrong file or missing | The attachment record, or media that never arrived | The attachment record. The old blob is still on the media branch. |
| The wrong author, date or status | Fields inside the document | The document. |
| A page vanished | One side trashed it and the other pushed the deletion | The document, then check the local trash. |
4. Restore the content
Three routes.
Revert the commit. This keeps the history and is safe on a branch other people read.
git revert --no-edit <sha>
git push origin main
Restore one file. Better when the bad commit mixed good work with bad. Check out the file from the last good commit, then commit it as a normal change.
git checkout <good-sha> -- items/<uuid>.json
git commit -am "Restore the about page"
git push origin main
Reset the branch. Only when the repository is yours alone. A force push rewrites the branch, removes the evidence and leaves every clone needing a fetch. Sync compares content, not history, so it will recover; you lose the trail.
git reset --hard <good-sha>
git push --force-with-lease origin main
Do not hand-edit the JSON unless the change is one field. Documents are deterministic: sorted keys, UTF-8, unescaped slashes, \n line endings and one trailing newline. A stray space turns a clean merge into a conflict.
5. Bring the local sites back
Each site keeps a base: the exact version of each item it last agreed with the repository, plus the commit it was read at. After a bad sync, the base says the bad version was agreed.
That is what makes a revert work. Your copy matches the base, the repository holds the restored version, so “ours equals base, take theirs” applies and the restore comes back without a conflict. If you edited the post since, you get a conflict instead. That is correct: Sync is asking which version you meant.
For a full recompare, clear the base. Changing the repository address or branch clears it, and so does deleting the staticscope_sync_base option. The next sync behaves like a first sync: documents that share a UUID but differ become Added twice conflicts rather than silent overwrites. There is no supported reset button, and doing this everywhere at once produces a queue you will not enjoy. One site at a time.
6. Re-sync one item
Sync has no per-item button. Every run exports every post and page and merges the lot. Restore one document in the repository and run an ordinary sync: only the items that differ are applied.
Watch the counts, not the toast. pulled includes attachment records. pushed excludes record-only changes and environment commits, so a commit can exist while pushed reports zero. deleted counts deletions applied here, not ones you pushed.
If the item is in the queue, resolve that one card. The endpoint applies the choice, advances its base and immediately syncs. If other conflicts remain, nothing is pushed.
7. Verify the build
Content is fixed in WordPress, not on the live site. Build a preview and open the affected page plus anything that links to it. Read the build report, then publish.
If the build is older than the restored content, publishing is refused: “Content changed since this build. Build a preview, then publish it live so the live site gets the newer content.” A preview built while Sync was broken is refused too. Both mean the files on disk predate the fix.
If you already published the bad content, the rebuilt preview replaces it. Publishing does not merge with what is live, so the preview you publish is the site you get.
Limits and constraints
- Media may have advanced. Media batches are pushed before the content commit. If that commit failed permanently, the media branch still moved, and reverting content does not rewind it. Blobs are never deleted, so the old file is still there.
- Manual errors are not persisted. A failed sync reports in the red box and nowhere else. Only cron and the build preflight write
staticscope_sync_error. Copy the message before you reload. - Old notices outlive their cause. A successful resolve does not clear a stored error or a skipped-media count, and disconnecting leaves the “built without sync” reason behind. A red box after a clean recovery may be history.
- Cron does not record skipped media. The warning belongs to manual sync and preflight. A background sync can fail on a file and say nothing.
- There is no WP-CLI. Automation runs through WP-Cron, the REST endpoints with a nonce, or your own PHP. A recovery is a screen-and-Git job.
- The repository is not a backup. It has no users, options, comments, revisions or plugin tables. Restoring a document is not restoring a site.
- Attachments are never deleted by a sync. Removing a bad image means editing the post and cleaning the library yourself. A revert will not do it.
Test the revert on one site first. Revert, sync that site, look at the page. A revert that fixes the repository and breaks three local sites is a second incident.
Next
- Notices and errors: what the message you copied means.
- How a sync runs: where media, base and the conflict gate sit in the sequence.
- Recover a failed publish: when the build or deploy is the part that failed.