Undo a bad edit by restoring a revision

ContentBeginner~5 min

Before you start

A connected site with content reads on and the restore-revision write ability enabled. The agent needs edit access to the post. WordPress revisions must be on for that post, which they are by default.

Everyone has that moment: an edit went sideways, a paragraph got mangled, a good version of a page is now buried under a worse one. WordPress has kept every revision the whole time, but scrolling the revision comparison screen and being sure which one to restore is the fiddly part.

This makes the undo a short conversation. The agent lists the history, shows you the version you are about to bring back with a diff against what is live, and restores it only once you confirm.

The prompt
Something got mangled in my [pricing] page in an edit earlier and I want to put it
back to the version from before.
Read only to start. List the revisions on [the pricing page] with their dates and
who saved them, and help me spot the last good one. Show me that revision's content
and a diff against what is live now so I am sure it is the right point.
Once I confirm which revision, restore the page to it. I know the restore itself
saves the current state as a new revision first, so if I picked wrong we can just
restore forward again.

Why this is safe to run

Listing the revisions and reading one are reads, so you review the exact content you are about to bring back, and its diff against the live page, before anything is restored. There is no guessing from a date alone.

The restore is the one write, and it is built to be reversible: before it rolls the post back, it saves the current live state as a fresh revision, so a wrong pick is undone by restoring forward to that new point. Nothing in the revision history is deleted. The restore ability stays off until you enable it, the call is checked against the capability of the user you bound the agent to, and it lands in the Activity Log with the post it changed.

Already connected? You do not have to paste this. Ask your agent for the “undo a bad edit by restoring a revision” recipe, or just tell it which page went wrong, and it runs the same read-first flow on your own site.

How it works

  1. List the revisions on the post with their dates and who saved them.
  2. Help you spot the last good version.
  3. Show that revision's content and a diff against what is live now.
  4. Wait for you to confirm the revision.
  5. Restore the post to it, which first saves the current state as a fresh revision.

Questions

Is restoring risky if I pick the wrong revision?
No. Restoring first saves the current live state as a new revision, so the restore is itself reversible. If you pick wrong, you restore forward to that fresh revision.
Does this delete the newer revisions?
No. Restoring rolls the live content back to an older revision and leaves the history intact, and it adds a new revision for the state you restored from, so nothing in the history is lost.