Updated on by Mario Röhreich, owner of CODERIDER GmbH (German)
In short: Almost always a single plugin or theme is at fault. Find it through the recovery mode email or the debug.log, turn it off by renaming its folder via SFTP or with wp plugin deactivate, then install an older version. If the update changed the database, only the backup from before the update helps, files and database together.
Stay calm and do not rush
A broken site after an update looks dramatic, but it is usually fixed quickly. Your data is almost always still there, only a piece of code fails to run. Do not install more updates at random and do not delete anything before you know what is going on. Write down which updates ran last. That is your best lead.
Use the WordPress recovery mode
Since WordPress 5.2, WordPress catches fatal PHP errors. Visitors see a notice about a critical error, and the site's admin email address receives a message with the subject "Your Site is Experiencing a Technical Issue".
- Open the email. It names the plugin or theme where the error occurred, often with file and line.
- Click the recovery mode link and log in. The faulty plugin is then paused for you only, and the admin works.
- Deactivate the plugin under "Plugins" or switch the theme.
- Exit recovery mode with the button in the toolbar and check the website as a visitor.
The link is only valid for a limited time. If no email arrives, for example because the site cannot send email at all, continue with the error log.
Find the cause in debug.log
Add these lines to wp-config.php above the line "That's all, stop editing!":
define('WP_DEBUG', true);define('WP_DEBUG_LOG', true);define('WP_DEBUG_DISPLAY', false);
Load the broken page again. WordPress writes the errors to wp-content/debug.log. Look for "PHP Fatal error": the path in the message, such as wp-content/plugins/example/..., tells you which plugin is at fault. Afterwards remove the three lines again and delete the log, since it can contain paths and other internals.
Turn off the faulty plugin without the admin
If you cannot get into the admin, turn the plugin off through the files.
- Via SFTP or file manager: rename the folder under
wp-content/plugins/, for example fromexampletoexample-off. WordPress can no longer find the plugin and deactivates it. If you do not know which plugin is at fault, rename the wholepluginsfolder, check the site, then bring the plugins back one by one. - Via SSH with WP-CLI:
wp plugin deactivate example --skip-plugins. The--skip-pluginsflag keeps WP-CLI from loading the broken plugin itself and failing on it. - Check the website. If it works again, you have found the culprit.
Turn off a broken theme the same way
If the error is in the theme, rename its folder under wp-content/themes/. WordPress then falls back to an installed default theme such as Twenty Twenty-Five. With WP-CLI: wp theme activate twentytwentyfive --skip-themes --skip-plugins. The site will look different, but it runs and you can get into the admin. A child theme needs its parent theme, the two belong together.
Install an older version of the plugin
Once the plugin is off, bring back the last version that worked.
- You will find the version number in the WordPress update email, in the log of your maintenance tool, or under "Advanced View" on the plugin's page at wordpress.org.
- With WP-CLI:
wp plugin install <slug> --version=<x> --force, thenwp plugin activate <slug>. If you renamed the folder, delete the renamed copy before or after. - Without WP-CLI: download the ZIP of the old version and upload it in the admin under "Plugins, Add New Plugin, Upload Plugin". WordPress asks whether to replace the installed version.
- Premium plugins are not on wordpress.org. Older versions are usually available in your account with the vendor.
- Turn off automatic updates for this plugin until the vendor has fixed the bug.
Watch out for database updates
After an update of WordPress core, the admin sometimes shows a notice that the database needs to be updated. The button in the admin or wp core update-db takes care of that. Plugins such as WooCommerce also change their tables during an update.
This matters for undoing the update: once the database has been changed, the old plugin version often does not run cleanly on it. Then restoring only the files is not enough. You need the database backup from before the update.
Clear the cache and OPcache
Sometimes the error is long fixed and you still see the broken page. So after every change, clear:
- the cache of your caching plugin, such as WP Rocket, W3 Total Cache or LiteSpeed Cache
- the cache at your host and your CDN, if you use one
- the object cache with
wp cache flush, if the site uses Redis or Memcached - the PHP OPcache. It keeps compiled code in memory. Restored files often carry their old modification date, so code from the failed update can keep running for a while. WP-CLI does not clear it, because it runs in a different PHP process. Restarting PHP in your host's control panel helps, often a brief switch of the PHP version does too.
The easiest way around the browser cache is a private window.
Restore the backup, database included
If none of this helps, or if an update of WordPress core went wrong, restore the backup from before the update. Files and database belong together: new files on an old database, or old files on a new database, are exactly the mix that causes the next error.
- Check when the backup was made and whether it contains both database and files.
- For shops and sites with forms: first export everything that came in since the backup. Otherwise orders, customer accounts, comments and form entries since the backup are gone.
- For shops, turn on maintenance mode while you restore, so no new order lands in that window.
- Restore the backup via your backup plugin, your host's control panel, or via SFTP and a database import.
- Clear all caches and check the home page, login, cart and contact form.
When maintenance mode gets stuck
If the site only shows "Briefly unavailable for scheduled maintenance. Check back in a minute.", an update was interrupted. During an update, WordPress creates a .maintenance file in the root folder, next to wp-config.php, and removes it at the end. If the update stops halfway, the file stays.
- Connect via SFTP. Files starting with a dot are often hidden, so turn on hidden files in your program.
- Delete the
.maintenancefile. - Clear the cache and check whether the interrupted update is complete. If in doubt, install the plugin again.
WordPress ignores the file by itself after ten minutes. If you see the message longer than that, the cache is often involved as well.
How to prevent broken updates
- Backup before every update. Database and affected folders, right before the update, not last night's backup.
- Check afterwards. Load the home page, login and the key pages such as shop, cart or contact form, not just the home page.
- Staging. Test big jumps, such as a new major version of WooCommerce or your page builder, on a copy of the site first.
- Update in stages. Not twenty updates at once. One at a time or in small groups, so you know right away which one is at fault. And not right before closing time or the weekend.
- Automatic rollback. A tool that checks the site after the update and restores files and database on an error, before anyone notices.
How CODERIDER Monitoring does this automatically
For agencies with many WordPress sites, we built exactly this process into CODERIDER Monitoring. Before every update, it backs up the database and the affected folders on the site's server. Afterwards it compares the home page, the login page and up to three check URLs with the state before. If anything got worse, it restores files and database automatically and clears the PHP cache as well. The details are on Updates with backup and rollback.
Common questions about broken updates
Why does WordPress show a critical error after an update?
Usually a plugin or theme stops with a fatal PHP error: it does not work with the new WordPress or PHP version, it conflicts with another plugin, or the update was only partly installed. The recovery mode email or the debug.log tells you which file is at fault.
How do I get into my site without access to the admin?
Via SFTP or your host's file manager. If you rename the plugin's folder under wp-content/plugins, WordPress deactivates it and the admin usually works again. With SSH, wp plugin deactivate does the same.
Can I simply undo a plugin update?
The files, yes: you can install an older version with WP-CLI using wp plugin install <slug> --version=<x> --force or upload it as a ZIP in the admin. If the update has already changed the database, though, the old version no longer matches it. Then only the backup from before the update helps, files and database together.
Will I lose data if I restore a backup?
Yes, everything written to the database since the backup: orders, comments, form entries, new posts. For shops, export the orders placed since the backup first and add them back afterwards.
What does "Briefly unavailable for scheduled maintenance" mean?
During an update, WordPress creates a .maintenance file in the root folder and removes it afterwards. If the update is interrupted, the file stays. WordPress ignores it by itself after ten minutes. If the message stays longer, delete the file via SFTP and clear the cache.
How do I keep an update from breaking my site?
Back up the database and files before every update, check the home page, login and key pages afterwards, test major updates on a copy of the site first, and do not install everything at once. A tool with automatic rollback handles backup, checks and undo by itself.