All guides

Site health

A WordPress plugin update broke my site: recover now, and roll back bad updates automatically

Get a site back after an update fatals it, roll the plugin back to the version that worked, and set WordPress up so the next bad update is tested and undone on its own.

9 min readUpdated

Why updates break sites

Most plugin and theme updates are fine. The ones that are not tend to fail in the same few ways:

  • A fatal PHP error. The new version calls a function that another plugin, the theme or your PHP version does not have. WordPress stops and the page shows "There has been a critical error on this website".
  • A clash with something else on the site. Two plugins that worked together yesterday load the same library in different versions, or one now hooks in earlier than the other expects.
  • A broken page rather than a broken site. The home page loads, but checkout, the login screen or the admin dashboard does not.
  • It happened overnight. Auto-updates run when nobody is looking, so the first person to find out is a visitor or a customer.

The first three can usually be fixed by putting the previous version back. The last one is why it pays to have that happen automatically.

Recover the site right now

If the site is down at this moment, get it back first and investigate afterwards.

  1. Check your email. Since WordPress 5.2, when a plugin or theme causes a fatal error WordPress emails the site admin a recovery-mode link. Opening it signs you in with the broken plugin paused, for you only, so you can deactivate it from the Plugins screen. Recovery mode does not roll anything back: visitors still see the error until you act.
  2. No email? Deactivate the plugin by hand. Over SFTP or your host's file manager, rename the plugin's folder in wp-content/plugins (for example gallery-slider to gallery-slider-off). WordPress deactivates a plugin whose folder has gone. For a theme, switch to a default theme the same way or from the Appearance screen once wp-admin loads.
  3. Put the previous version back. For a plugin from WordPress.org, WP-CLI can install a specific release: wp plugin install gallery-slider --version=2.3.1 --force. For a premium plugin, use the vendor's download of the version you had, or restore it from a backup.
  4. Stop it updating again until the vendor ships a fix: turn off auto-updates for that plugin on the Plugins screen.

If you are not sure which plugin is responsible, the error message usually names a file under wp-content/plugins/<folder>, and that folder is the culprit. If the site is up but behaving oddly, and nothing names a file, see the guide to finding which plugin is slowing down WordPress: the same leave-one-out approach finds a plugin that breaks things as well as one that slows them down.

What a full rollback has to put back

Replacing the plugin's files is often enough, but not always. An update can also change the plugin's own database tables and settings (a "database upgrade" on first load). Putting old code back on top of upgraded data can leave the plugin broken in a new way.

A complete rollback restores:

  • The files of the plugin or theme, exactly as they were.
  • Its own database tables, if the update changed them.
  • Its own options, the settings it stores in wp_options.

And it must leave everything else alone: your posts, orders, users and every other plugin's data carry on from where they are now. Restoring a whole-site backup to undo one update throws away every order and comment since the backup was taken, which is why a full backup is the wrong tool for this job.

What WordPress already does on its own

Since WordPress 6.6, core has a safety net of its own, but a narrow one. During a background automatic update of an active plugin, it requests your home page once and, if that shows a PHP fatal error, puts the plugin's previous files back. It does nothing for updates you run from the Plugins or Updates screen or with WP-CLI, for themes or for inactive plugins. It checks no page but the home page, and it puts back files only, never the plugin's tables or settings.

Rollback plugins such as WP Rollback cover a different gap: they reinstall an earlier WordPress.org version when you ask, once you have noticed the problem. They do not test an update or act on their own.

Make every update undo itself if it breaks the site

Dragon Safe Updates does this on every update, however it is started: the Plugins and Themes screens, bulk updates, overnight auto-updates and WP-CLI. It is free on WordPress.org with nothing locked. For each update it runs four steps:

  1. Snapshot. Just before the new files go in, it zips the current files and saves the tables and options that provably belong to that plugin or theme. Every part of the snapshot is encrypted before it is stored, so a copy fetched from the web server cannot be read.
  2. Install. WordPress installs the update exactly as it normally would.
  3. Test. Straight afterwards it requests your own pages from your own server (home, admin, login, a recent post and page, the REST API and, with WooCommerce, the shop, cart and checkout, plus any URLs you add) and checks that WordPress answered without a fatal error. It uses the same fatal-error check WordPress itself runs when you edit a plugin file.
  4. Verdict. If the test finds real breakage, the update is rolled back on the spot: files, plus the package's own tables and options.

Updates: each pending update with its installed and offered versions, Preview changes, a version held after a rollback, and Update safely.
Updates: each pending update with its installed and offered versions, Preview changes, a version held after a rollback, and Update safely.

Set it up in a few minutes:

  1. Install and activate Dragon Safe Updates, then open Dashboard, then Safe Updates.
  2. Check the Protection level panel. Full protection means snapshots, testing and automatic rollback are all available. If it says something else, it explains what is missing, for example the PHP sodium extension.
  3. Open the Probes tab and tick the pages that matter. Add custom URLs for anything that must never break: a booking form, a members area, a landing page that takes paid traffic.
  4. On Settings, keep Automatic rollback and Email about a broken update on.
  5. From now on, update as you always do. The Updates tab also offers an Update safely queue that runs several updates one at a time, testing the site after each one.

Only real breakage is rolled back

An automatic rollback is a strong action, so it is reserved for failures that are clearly the update's fault:

  • a PHP fatal error,
  • a server error that WordPress itself reported,
  • and, confirmed with one retry against a recent healthy reading of the same page, a server error PHP never answered, no response at all, or a page that now returns an error such as 404.

That last group needs a trustworthy reading to compare with. If the site has changed since the reading was taken (a different theme, other active plugins, other probe pages) or there is no reading yet, only a PHP fatal error or a server error WordPress reported can roll an update back, and a page that fails in another way is reported as a flag.

Everything else is reported, not acted on. A redirect, a page that was already failing before the update, a slower response, a changed page size, changed settings or a change-risk signal all show up as flags on the History row for you to look at. Safe Updates takes a reading of your pages once a day and after each update that is not rolled back, so there is usually something recent to compare with.

A rolled-back update: the fatal error with its file, line and stack trace, the probe that caught it, the change-risk signals and the restore steps.
A rolled-back update: the fatal error with its file, line and stack trace, the probe that caught it, the change-risk signals and the restore steps.

When an update is rolled back, the History row shows the error with its file and line, every page it tested and what it put back. The version that broke the site is then held: WordPress still lists the update, but Safe Updates refuses to install it, automatically or by hand, until you clear the hold under Settings. That stops the overnight auto-update from installing the same broken release again the next night.

Errors that turn up later

Some updates only fail on a page the test did not visit, or on the first scheduled job that runs after them. For 72 hours after an update (the watch window, adjustable in Settings), a fatal error in that plugin or theme is attributed to the update, and an admin notice links straight to rolling it back from the snapshot taken just before it.

You can also roll back by hand at any time from the Snapshots tab: restore a kept snapshot, or, for a plugin from WordPress.org, pick any earlier released version. A manual rollback is itself tested like any other update.

Snapshots: storage used, the snapshots kept for each plugin and theme, and rollback to any earlier WordPress.org release.
Snapshots: storage used, the snapshots kept for each plugin and theme, and rollback to any earlier WordPress.org release.

Know what changed before you update

Before you click update, Preview changes on the Updates tab compares the new release with what is installed, file by file, and points out patterns worth a human look: new remote hosts contacted, eval() or obfuscated code, shell execution, code that creates admin users, PHP files in unexpected places. These are signals, not a malware verdict, but a minor release that suddenly adds outbound requests to an unknown host is worth reading about before it goes live.

Two other habits help:

Limits worth knowing

  • Single sites only. Multisite networks are not supported yet; the plugin will not activate on one.
  • Single-file plugins cannot be protected. A plugin that is one .php file directly in wp-content/plugins, with no folder of its own, cannot be snapshotted, so its updates are recorded as unprotected.
  • "Tested" means your configured pages answered normally. It is a check of this site after the update, not a review of the plugin's code, so add the pages that matter to the Probes tab.
  • A page that loads but looks or works wrong is not caught. A broken layout, a JavaScript error or the wrong page answering normally all pass the test, and so does an error on a page it does not request.
  • A page cache in front of the site hides the answer. When a cache or CDN replies instead of PHP, that page's test is inconclusive, and an update with only inconclusive tests is marked untested, never rolled back.
  • Manual rollbacks later need direct file access. Automatic rollback during an update always works, but restoring a snapshot afterwards from the Snapshots or History tab needs WordPress to write files directly, not over FTP.
  • WordPress core updates are not covered; this is about plugins and themes.

Site health

How to find and fix broken links in WordPress

Find broken internal, external and image links across a WordPress site, triage them without false alarms, fix them safely in the block editor, and stop new ones appearing.

7 min readRead