Home / Guides / WordPress handbook / Chapter 10
WordPress handbook · Chapter 10 · Troubleshooting
Plugin and Theme Troubleshooting Procedures
Good troubleshooting is a method, not a talent. This chapter gives a repeatable procedure that works on problems you have never seen before. It narrows the search from "something is broken" to one component, one change and one line of evidence, without making the site worse along the way.
On this page
Principles before procedure
- Evidence before action. Logs, error messages and timestamps first; changes second.
- Protect production. Do experiments on staging or in troubleshooting mode, which affects only your session. If you must change production, take a backup and change one thing at a time.
- Find the first failure. Errors cascade. The fourth error in the log is often caused by the first.
- Correlation is a lead, not proof. "It broke after the update" is a hypothesis to test, not a conclusion.
- Keep a log of what you did. Time, change, result. It makes rollback and escalation fast.
The diagnostic methodology, step by step
1 · Reproduce the issue
A problem you can trigger on demand can be fixed and verified; one you cannot reproduce cannot. Establish:
- The exact URL and steps (for example "add product X to cart, go to checkout, choose PayPal").
- Who is affected: logged-in vs logged-out, specific roles, all visitors or some.
- Where: browser, device, network or country; a private window helps rule out cookies and extensions.
- How often: always, intermittently, or at certain times (intermittent plus time-based points to load, cron or backups).
If you cannot reproduce it, gather the reporter's exact details: screenshot, time with time zone, URL, browser, IP address. Then search the logs for that time.
2 · Record the exact error
Copy error text exactly. "There has been a critical error" and "Error establishing a database connection" point to completely different layers, while "the site is down" points nowhere. Capture: the HTTP status code (developer tools Network tab), the full message, the page source if blank, console errors, any request or ray ID shown by a CDN, and the time. Paraphrased errors waste everyone's time, and support teams cannot search logs for them.
3 · Identify when it started
Pin down the first known bad time and the last known good time. Sources: uptime monitoring alerts, the first occurrence in error logs, customer reports, analytics drops (conversions to zero at a specific hour), form submission gaps, order history gaps. The window between last-good and first-bad is where you look for changes.
4 · Review recent updates and changes
Most incidents follow a change. List every change in the window, including those nobody "did":
- Plugin, theme and core updates, including automatic ones (activity log, update emails, file modification dates in
wp-content/plugins/). - Settings changes in WordPress or plugins (activity log).
- Hosting changes: PHP version switches, server migrations, maintenance notices, new firewall rules.
- DNS, CDN, certificate or email provider changes.
- Content changes: a huge import, a new page with a heavy builder layout, a new redirect.
- Expiries: licences, API keys, certificates, domain names, payment gateway credentials.
wp plugin list --fields=name,status,version,update_version
# Files modified in the last 2 days under wp-content (excluding uploads and cache)
find wp-content -path wp-content/uploads -prune -o -path wp-content/cache -prune -o -type f -mtime -2 -print | head -50
Unexpected recently modified PHP files that no update explains are also a compromise indicator (Chapter 11).
5 · Inspect PHP logs
Find the PHP error log (hosting panel "Errors"/"Logs", ~/logs/, or the path in Site Health → Info → Server). Search around the failure time for PHP Fatal error, PHP Parse error, Uncaught, Allowed memory size, Maximum execution time. See Reading PHP error messages below to interpret them. Warnings and deprecations are usually background noise unless they started at the same time as the problem.
6 · Inspect WordPress logs
WordPress-level sources:
- debug.log when
WP_DEBUG_LOGis enabled (see Enabling debugging safely). - Recovery-mode emails to the admin address, naming the extension that caused a fatal error.
- Site Health (Tools → Site Health): REST API, loopback, cron, PHP and database checks.
- WooCommerce → Status → Logs:
fatal-errorslogs plus gateway, webhook and integration logs. - Action Scheduler (Tools → Scheduled Actions): failed background jobs with error messages.
- Activity logs and plugin-specific logs (SMTP logs, security plugin logs, redirect 404 logs).
7 · Inspect browser developer tools
Many problems happen entirely in the browser and never reach a server log. Open developer tools (F12, or Ctrl/Cmd+Shift+I) and reload:
- Console: JavaScript errors (the first red error matters most, because later ones often cascade from it), mixed-content warnings, CSP violations, CORS errors. The file path in an error (
/wp-content/plugins/plugin-name/...) identifies the culprit; minified or combined files hide it, so retest with optimisation disabled. - Network: tick "Disable cache" and "Preserve log". Look for red (failed) requests, 4xx/5xx statuses, slow requests (sort by time), and for AJAX/REST calls (
admin-ajax.php,wp-json,?wc-ajax=) open the Response tab to see the real error. Response headers show cache status (x-cache,cf-cache-status) and the redirect source (x-redirect-by). - Application / Storage: cookies (WordPress login and WooCommerce session cookies, their domain and expiry), local storage, service workers that may serve stale pages.
- Elements: whether expected HTML is present but hidden by CSS (layout problem) or missing (server-side problem).
8 · Inspect server, access and CDN logs
The web server error log records .htaccess syntax errors, permission problems, upstream (PHP-FPM) failures and limit violations. The access log records every request with status and timing: use it to see whether the failing request reached the origin at all, what status it got, and whether a traffic spike or a single abusive client coincided with the problem. The PHP-FPM log records worker exhaustion and crashes. CDN/WAF event logs show blocks and challenges that never reached your server.
# Most frequent status codes today
awk '{print $9}' access.log | sort | uniq -c | sort -rn | head
# Top IPs hitting the site
awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -20
# Requests that returned 5xx, with path
awk '$9 ~ /^5/ {print $4, $9, $7}' access.log | tail -50
# Worker exhaustion warnings
grep -i "max_children" /var/log/php*-fpm.log | tail
Field positions assume the common "combined" log format; adjust if your host uses a different format.
9 · Isolate: stop guessing and test
Once the evidence points to an area, isolate it with controlled tests: plugins (by halves), theme (switch to a default theme), configuration (compare staging and production), or infrastructure (bypass CDN or cache). The next sections describe each. Change one variable per test and write down the result.
10 · Fix, verify, document, prevent
Apply the smallest change that addresses the root cause. Verify by reproducing the original steps (as the affected user type), checking the logs are clean, and checking adjacent features you might have affected. Document cause, fix and evidence. Then ask what would have caught this sooner, and add that: a monitor, a staging step, an update policy, an alert.
Enabling debugging safely
WordPress debug mode writes notices, warnings and errors to a log. On production, log, do not display, and log to a path outside the web root, because the default wp-content/debug.log can be downloaded by anyone who requests it.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', '/home/example/logs/wp-debug.log' ); // path outside the web root
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', '0' );
// Optional while diagnosing script problems in the admin:
// define( 'SCRIPT_DEBUG', true ); // loads unminified core JS/CSS
Verify
Reproduce the problem and confirm entries appear in the log file. The page itself must not show error text.
What could go wrong
Busy sites can write gigabytes of notices quickly; a typo in wp-config.php takes the site down.
Rollback
Set WP_DEBUG back to false (or remove the lines) as soon as you have the evidence; delete or archive the log.
Escalate when
No PHP errors are logged but the failure persists. Then the problem is likely in the server, the browser or an external service.
Reading PHP error messages
[02-Dec-2026 09:14:07 UTC] PHP Fatal error: Uncaught Error: Call to undefined function acme_get_settings()
in /var/www/example.com/public/wp-content/plugins/acme-addon/includes/class-loader.php:48
Stack trace:
#0 /var/www/example.com/public/wp-includes/class-wp-hook.php(324): Acme_Loader->init('')
#1 /var/www/example.com/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#2 /var/www/example.com/public/wp-settings.php(704): do_action('plugins_loaded')
...
- Timestamp: match it to the failure time (watch for UTC vs local time).
- Severity: Fatal and Parse errors stop execution. Warning, Notice and Deprecated usually do not, but deprecations predict breakage on future PHP versions.
- Message: "Call to undefined function" here means the add-on expects its parent plugin (which defines
acme_get_settings) to be active or newer. - File and line:
wp-content/plugins/acme-addon/names the plugin. A path inwp-content/themes/names the theme;mu-pluginsnames a must-use plugin (often host code);wp-includesorwp-adminusually means core was called with bad data by something further down the stack trace. - Stack trace: read bottom-up for the sequence of calls. Here, the error occurred during
plugins_loaded, so it happens on every request.
| Common message | Usual meaning |
|---|---|
Call to undefined function / method | Missing dependency, deactivated parent plugin, version mismatch, or a removed PHP function |
Cannot redeclare function / Cannot declare class ... already in use | Two plugins (or two copies of one plugin) define the same name |
Uncaught TypeError: Argument #1 must be of type array, null given | PHP 8 strictness exposing a plugin bug; often after a PHP upgrade |
syntax error, unexpected ... (Parse error) | An edited file has a typo, or code needs a newer PHP version than the server runs |
Cannot modify header information - headers already sent by (output started at file:line) | Output (often whitespace or a BOM before <?php) was sent before a redirect or cookie; the "output started at" file is the culprit |
Failed opening required '...' | A file is missing: incomplete upload or update, wrong path after migration, or files removed by a scanner |
Allowed memory size exhausted / Maximum execution time exceeded | Resource limits (Chapter 06) |
Isolating plugins
Option A: Troubleshooting mode (preferred on production)
The Health Check & Troubleshooting plugin, maintained by WordPress.org contributors, adds a troubleshooting mode under Tools → Site Health → Troubleshooting. For your browser session only, it disables all plugins and switches to a default theme; visitors still see the normal site. You can then enable plugins one at a time from the admin bar. Limits: it cannot help with problems that only appear for logged-out visitors or come from server-level caches, and some must-use plugins stay active.
Option B: Half-split (binary search) on staging
With 40 plugins, testing one at a time takes 40 rounds. Halving takes about 6:
- Deactivate half the plugins (keeping essentials such as WooCommerce if the problem involves them). Test.
- If the problem disappears, the cause is in the deactivated half; otherwise it is in the active half.
- Split the suspect half again and repeat until one plugin remains.
- Confirm by toggling that single plugin on and off. If the problem needs two plugins to appear (a conflict), you will find that removing either fixes it. Test them together and apart.
wp plugin list --status=active --field=name > active-plugins.txt # save the current state first
wp plugin deactivate plugin-one plugin-two plugin-three
wp plugin activate plugin-one
# Restore everything from the saved list:
wp plugin activate $(cat active-plugins.txt)
# Skip loading plugins/themes for one command (useful when WP-CLI itself fatals):
wp plugin list --skip-plugins --skip-themes
Option C: When wp-admin is inaccessible
If a fatal error blocks the admin and recovery mode is not available, rename the suspect plugin's folder over SFTP or the file manager (for example wp-content/plugins/acme → acme.off). WordPress deactivates a plugin whose folder disappears. Renaming the entire plugins folder deactivates all of them. When you rename back, plugins stay deactivated and must be reactivated individually, so save the active list first if you can (active_plugins option, or wp option get active_plugins).
Deactivating some plugins has consequences: security plugins remove firewall rules, caching plugins purge caches and remove drop-ins, membership plugins expose restricted content, and a few plugins delete data on deactivation (rare, but read the settings). On production, prefer troubleshooting mode or staging.
Isolating the theme
Switch to a current default theme (for example Twenty Twenty-Five) in troubleshooting mode or on staging. If the problem disappears, it lives in the theme or its interaction with a plugin. Next steps:
- If you use a child theme, switch to the parent alone. A problem that disappears is in your child theme's customisations.
- Check WooCommerce → Status for "outdated template overrides", which are a common cause of store bugs after WooCommerce updates.
- Check the theme's
functions.phpfor custom code added by previous developers, and move code that is not presentation into a site-specific plugin. - Keep at least one default theme installed so you always have a known-good fallback.
Switching themes on production changes widgets, menus and customiser settings assignments. Do it only in troubleshooting mode or staging.
Recovery mode
Since WordPress 5.2, when a fatal error occurs WordPress emails the site admin address (or RECOVERY_MODE_EMAIL if defined) with details of the error and a special link. Following the link starts a recovery-mode session: the broken plugin or theme is paused for that session only, so you can log in, read the error, and deactivate, update or replace the extension. The link expires after a period; if the email never arrives (often because site email itself is broken), use SFTP or WP-CLI instead. Leave recovery mode with the "Exit Recovery Mode" button once fixed.
Staging, comparison and rolling back versions
Staging
A staging site is a copy of production (files and database) at a separate URL, used to test updates and fixes safely. Many hosts create one in a click. When building one yourself:
- Block search engines (Settings → Reading discourage indexing, plus HTTP authentication).
- Set
WP_ENVIRONMENT_TYPEtostaging; well-behaved plugins use it to disable live integrations. - Disable outbound email and live payments, or route email to a catch-all. Staging copies of stores have sent real customer emails and processed real renewals.
- Disable scheduled jobs that sync with external systems (ERP, CRM, marketplaces).
- Treat staging data as production data. It contains the same personal information.
Compare environments
When something works on staging but not production (or the reverse), compare: PHP version and extensions (Site Health → Info → copy to clipboard on both, then diff), plugin versions, wp-config.php constants, server type, caching layers, CDN, and data volume.
Rolling back a plugin or theme version
wp plugin install example-plugin --version=2.4.1 --force # reinstall a specific earlier version (example slug/version)
wp plugin auto-updates disable example-plugin # prevent it re-updating while you investigate
Rolling back code does not roll back database migrations. Major updates of WooCommerce, page builders and LMS plugins often upgrade database tables, and older code may not understand the new data. For those, restore the database backup taken before the update as well (on staging first), or work forward with the vendor. Premium plugins are rolled back by uploading the earlier ZIP from the vendor's account area.
When and how to escalate
Escalate to the host when evidence points below WordPress: 502/503/504 with FPM or resource messages, database server failures, disk problems, server configuration you cannot edit, email ports blocked, platform caches, suspected server compromise. Escalate to the plugin or theme developer when a fatal error or bug is clearly in their code. Escalate to a developer or security specialist for custom code, complex conflicts, data corruption, or any suspected breach involving customer data.
Support request template
Site URL: https://example.com
Environment: production / staging
What happens: (exact error text + screenshot)
Steps to reproduce: 1. ... 2. ... 3. ...
Who is affected: logged-in / logged-out / role / all visitors
First noticed: 2026-12-02 09:14 SAST (UTC+2)
Last known working: 2026-12-01 18:00 SAST
Recent changes: (updates, settings, hosting, DNS)
Error log excerpt: (the relevant PHP / server lines, not the whole file)
Versions: WordPress x.y.z, PHP x.y, plugin x.y.z, theme x.y.z
Already tried: (each test and its result)
Request / ray ID (if shown): ...
Never include passwords, API secrets or customer personal data in a support request. Use the provider's secure credential-sharing method, or create a temporary, limited account for them, and remove it afterwards.
Troubleshooting worksheet
A reusable checklist for each incident. Reset it before the next one.
- Backup confirmed before any change.
- Issue reproduced; affected users, URLs and conditions recorded.
- Exact error text, status code and screenshots captured.
- First-bad and last-good times established.
- Changes in that window listed (updates, settings, hosting, DNS, expiries).
- PHP error log checked around the failure time.
- WordPress logs checked (debug.log, Site Health, WooCommerce logs, Scheduled Actions).
- Browser console and network requests inspected.
- Server access/error logs and CDN/WAF events checked.
- Caching ruled in or out (logged-in vs logged-out, cache headers, bypass test).
- Plugins isolated (troubleshooting mode or half-split on staging).
- Theme isolated with a default theme.
- Root cause identified with evidence.
- Fix applied as the smallest change; rollback path known.
- Fix verified as the affected user type; logs clean; adjacent features checked.
- Incident documented; preventive measure added.
Rather have someone else keep WordPress healthy?
Our managed hosting and care plans cover updates, backups, security monitoring and fixes like the ones in this handbook, so you can get on with running the business.
See Hosting & Care