Skip to content

Undo and change history

Since 1.11.2 the plugin keeps a change history. When an agent edits something with one of 25 of the plugin’s tools, the plugin saves the earlier value first, and you can put it back from the Changes tab in wp-admin. It is on by default and it covers those 25 tools only. Every write tool says in its response whether its change can be undone. The short version, with a screenshot of the Changes tab, is on undo what an AI agent changed in WordPress.

These are the 25 tools. Each one is off until you enable it, like every other tool. A tool that does not appear in this table does not record its changes.

What the agent changed Tools
Posts, pages and custom post types Update post, Update page, Update content item
Find and replace, and block edits Replace in post, Replace block, Replace sitewide
Creates Create draft, Create post, Create page, Create content item
Trashes Trash post, Trash page, Delete block (reusable blocks go to the Trash)
Terms Add post terms, Update term
Custom fields Update post meta, Delete post meta, Update term meta, Delete term meta
Featured images Set featured image
SEO fields Update post SEO (Yoast), Update post SEO (Rank Math), Update post schema (Rank Math), Update post SEO (Slim SEO), Update post SEO (All in One SEO)

For a post-level edit the plugin records the title, content, excerpt, slug, status and dates, plus any terms, featured image and custom fields the call touched. For Update page that includes the page’s parent and template. A find and replace across many posts is recorded as one group.

The list did not grow in 1.12.0. None of the tools added in that release, the Avada and WPBakery Page Builder tools and the two navigation tools, is recorded here. The builder tools have their own way back, covered below.

The Changes tab is for administrators. Each row shows when the change happened, the tool, the item, the field names it touched (never their contents), who made it, a status and an action. The status is Can revert, Reverted, Expired or Cannot revert, and a Cannot revert row gives the reason.

  • Revert puts the earlier value of those fields back, if the item has not been edited since. Undoing a create moves the item to the Trash, and undoing a trash takes it back out.
  • Revert all appears on a site-wide find and replace and reverts, as one action, every post that call changed and that has not been edited since. It tells you how many it could not revert.
  • Clear history empties the table.
  • Compare revisions links to WordPress’s own revision screen for a content edit, when the post has a revision to compare.

A revert is recorded as a change of its own, so you can revert a revert.

The plugin refuses a revert that would overwrite a newer edit. A revert is refused when:

  • the item was edited after the agent’s change, or the revert would overwrite a newer edit
  • the change is older than 30 days, or the history was full and the oldest values were dropped first
  • the change was too large to keep, or a plugin filters the field, so it cannot be restored exactly
  • a page builder now owns the post, or the Trash is switched off and the revert needs it
  • the custom field key looks like a secret, so no copy of its value was kept
  • the item or term the change depends on no longer exists

A refused revert changes nothing, and the Changes tab shows the reason.

Two tools let an agent look at and undo its own recent work. Both start off, so nothing here reaches an agent until you enable them in the Abilities tab.

  • List changes (aafm/list-changes), a read tool. It lists the changes this connection made to one post or term in the last 24 hours, newest first: the tool, the field names, the time, and whether Undo change can revert each one now.
  • Undo change (aafm/undo-change), a destructive tool. It reverts one of those changes by the id List changes returned.

The limits are on purpose:

  • Own connection only. An agent sees and undoes only what its own connection changed. Another connection’s changes, and your own reverts, are for you to revert from the Changes tab. Only agent tool calls and your own reverts are recorded, not edits you make in the editor.
  • Last 24 hours. Older changes are yours to revert, up to the 30 days the history keeps them.
  • One change per call, 30 calls an hour per connection. A connection means one OAuth app or one Application Password.
  • Same rules as the original edit. Undo change checks again that the connection may still make that edit, and it puts the earlier value back only if nothing else has edited those fields since. Undoing a create moves the item to the Trash.
  • Refused today even when it was allowed then. An agent’s undo is refused when the tool that made the change is off for that connection now (for a create, the matching Trash tool), when the connection no longer has the capability for it, when a value would fail the rules the original tool applies (an exposed-key allowlist, a term ID, a URL), or when Force draft or a missing publish capability would change the status being restored. The answer in those cases is to ask the site owner.
  • An undo cannot be undone by the agent. It is recorded as its own change, which only you can revert from the Changes tab. A response can also report reverted_with_differences and list what could not be restored exactly.

Read-only mode keeps Undo change out of the agent’s tool list, like any other write. Because Undo change is destructive, the Read only, Content editor and Shop manager presets leave it out. The Custom preset narrows nothing, so a Custom connection reaches it once you enable it. See Controlling each connection.

Every write tool’s response says whether the change can be undone. It carries undoable, the change_ids that can be reverted, and a plain reason when it cannot, such as a permanent delete, an order or a refund. An agent can use that to decide whether to ask you first.

The Avada and WPBakery Page Builder tools are not recorded in the change history, so the Changes tab and Undo change can’t revert them. Most of them return their own way back instead:

  • Element, template and Library edits return restore_revision_id when WordPress keeps a revision. Pass it to Restore revision (aafm/restore-revision) to bring the page back. When there is no restore point, reversible_reason says why.
  • Replace text in a WPBakery page keeps the WordPress revision when revisions are on, but does not return its id. Find it with List revisions and pass it to Restore revision.
  • Remove element is refused, with nothing saved, when no revision could bring the element back: revisions are off, the site keeps only one revision per post, or the target keeps no revisions (an Avada form or off canvas panel, or a WPBakery Grid Builder template).
  • Settings, page code and CSS, page options, layouts and slider settings keep no revision. The response returns the old values in previous; send them back with the same tool to undo the change.
  • An imported Avada Studio item is removed by deleting it in Avada’s Library.

Since 1.12.0, Restore revision works on Avada and WPBakery pages while that builder is active. It is refused when saving the revision as your user would change it or the current page, and for a revision made with the other builder. It stays refused on pages owned by the other page builders.

No other tool of this plugin can be undone. That includes:

  • permanent deletes, such as Delete post, Delete page and Delete media
  • orders and refunds
  • user accounts and site settings, including the static homepage
  • file uploads
  • WooCommerce products, ACF field values, menus, block-theme navigations, comments and events
  • the Avada and WPBakery Page Builder tools, apart from the way back above
  • tools that come from other plugins, because bridged tools are not recorded
  • notifications, webhooks and anything the agent already read, which are never recalled

For any of those, keep your own copy. WordPress’s revisions help only partly: WordPress saves no revision when a post is first created and stores the new state on an update, so the first edit to a post with no earlier revisions leaves no earlier copy. Update navigation works the same way: WordPress keeps the new version as a revision, so an earlier version can be restored only if it was already kept as one.

The history keeps changes for up to 30 days. A row cap (20,000 rows) and a site-wide size cap (256 MB) drop the oldest values sooner when they are reached, so treat 30 days as a ceiling. A single change larger than 2 MB is not kept at all, and cannot be reverted.

The Changes tab shows field names, never contents, but the earlier values themselves are stored in a table in your site’s database. Treat that table as site content. A custom field whose key looks like a secret (a name with a whole word such as password, secret, token, API key, private key, license key, access key, auth or credential) is never stored, and that change cannot be reverted.

You can add your own patterns with the aafm_undo_secret_key_patterns filter. It receives the default pattern and can only add to it, never remove it. A pattern that fails to compile counts as a match, so the key is treated as a secret.

add_filter( 'aafm_undo_secret_key_patterns', function ( array $patterns ): array {
$patterns[] = '/^_acme_license/i';
return $patterns;
} );
  • Settings. The Keep change history switch turns recording off. Earlier changes stay until they expire, and the Changes tab says recording is off. Turning the switch on or off is written to the Activity Log.
  • Only while the plugin is active. Changes made while it is deactivated are not recorded.
  • Export and erase. WordPress’s Export Personal Data and Erase Personal Data tools cover the change history and the Activity Log.
  • Uninstall. The table is dropped on every uninstall, whatever the keep-data setting says.
  • Reset. The Reset plugin to defaults button in the Danger zone of the Settings tab empties it, and turns recording back on.