Fix a critical error
Get a site back that shows the WordPress critical-error message or a white screen. Rescue mode keeps your AI app connected to find and undo the cause.
When a plugin, a theme or a bad edit causes a fatal PHP error, visitors see "There has been a critical error on this website" or a blank page. PowerWP AI keeps a way in for your AI app, called rescue mode, so it can read the error, find the cause and undo it.
The short version. Paste this into your AI app. It looks first and changes nothing until you say yes. The steps below show what happens, one by one.
My site shows "There has been a critical error". Find out why, tell me your smallest fix and what it would affect, and wait for my OK before you change anything.What you need#
- Read-only diagnostics is enough to find the cause. On the Free plan you can do that part, then fix the cause yourself in wp-admin or in your hosting panel. To let your AI app apply the fix, upgrade; the key stays the same.
- To fix it, the connection needs Plugins & themes (to deactivate a plugin or switch the theme) and Settings & maintenance (to switch rescue mode, debug mode and caches). To roll back a change it also needs the permission that change needed, for example Files. The Developer preset has all of these.
Before you start#
Rescue mode only changes what your AI app sees. For requests from connected AI apps, WordPress loads PowerWP AI without your other plugins and without your theme. Visitors keep seeing the error until the cause is fixed.
Rescue mode helps an AI app that was already connected before the crash, so connect your app while the site is healthy. It starts for apps that connect with a key. If your app cannot reach the site at all, use the recovery-mode link that WordPress e-mails to the administrator address, or your hosting panel. Without a working connection, nothing here can start.
You do not need a backup or checkpoint to look. Your AI app sets a checkpoint before it fixes anything.
Steps#
- Describe what you see and let it look. Nothing changes yet.
- Example prompt
My site shows "There has been a critical error" on https://your-store.com/shop/. Find out why. Don't change anything yet.
- Your AI app will use
rescue_mode(status), thenpage_checkon the home page and the failing address. - If the crash happened while the app was connecting, rescue mode switches on by itself for 30 minutes and the app is told to try again.
- Read the error log. The newest fatal error usually names the file that caused it.
- Example prompt
Show me the newest fatal errors from the last day and which plugin or theme file they come from.
- Your AI app will use
error_log_readwith the debug log and the PHP log, and on a store the WooCommercefatal-errorslog. - No log? Ask your AI app to switch on debug mode (
debug_mode). It switches itself off again after 60 minutes unless you set another time.
- Name the cause. A path such as
wp-content/plugins/gallery-pro/...points at that plugin. The app compares it with recent changes and recently modified files.- Example prompt
Which change or update most likely caused this? Show me the evidence.
- Your AI app will use
changes_list,plugins_listandfs_find.
- Agree the smallest fix. Delete nothing.
- Example prompt
Tell me your smallest fix and what it would affect. Wait for my OK.
- The options, in this order: roll back the change that caused it (
changes_rollback, with a dry run first), deactivate the plugin (plugin_manage), switch to a default theme (theme_manage), or a small edit to a file that was just changed (fs_edit).
- Apply the fix.
- Example prompt
Go ahead. Set a checkpoint first, then deactivate that plugin.
- Your AI app will use
checkpoint_create, then the fix you approved.
- Check, then leave rescue mode.
- Example prompt
Check that the home page and the shop load normally again, then switch rescue mode off.
- Your AI app will use
rescue_mode(test, which probes the normal site),page_checknormally and withuse_cache=true,error_log_readfor the last ten minutes, thenrescue_mode(disable) andcache_flush.
- Check the pages that matter. On a store, look for orders that failed during the downtime.
- Example prompt
Check my key pages and look for failed or stuck orders from the time the site was down.
- Your AI app will use
page_checkand, with WooCommerce,wc_overview.
Check the result#
page_checkreports status 200, no critical-error screen, no PHP messages in the page and a normal word count. A 200 with no words is still a blank page.- The error log shows no new fatal error since the fix.
- PowerWP AI › Dashboard shows rescue mode as off.
- Open the site in a private browser window, as a visitor would.
How to undo#
The fix is recorded in PowerWP AI › Changes. A plugin you deactivated can be switched on again by rolling back that change. Do this only after the cause is gone, for example after the plugin's developer ships a fix, or the plugin will crash the site again.
If a rollback stops with a conflict, the item was changed again afterwards. Ask your AI app to show the change with change_details before you decide to force it.
Switching rescue mode on or off, and flushing caches, are not recorded for undo. Rescue mode ends by itself after its time.
A restore from backup is the last resort, because it replaces the database or the files and cannot be undone. Your AI app does it only when you explicitly ask. See Backups and restore.
PowerWP AI reverts a change on its own when a plugin, theme or code-file change made through it breaks the site. See Automatic health check for the full list. A crash caused somewhere else, such as an update started in wp-admin or an automatic update, is not covered. Rescue mode is for those.
Recipes that do this#
site_recovery follows these steps and asks for your OK before it changes anything. diagnose_site gives a wider health report once the site works. On a store, run woocommerce_checkup afterwards.
To prevent a repeat, update with before_plugin_updates and keep a recent backup.