TechCorner HQ · Technical Troubleshooting Guide

WordPress Troubleshooting Guide: A Safe Diagnostic Workflow for Common Site Problems

By TechCorner HQ Editorial Desk Last reviewed Review standards

A Repeatable Diagnostic Framework for WordPress

When a WordPress site breaks, panic often leads to chaotic troubleshooting: randomly deactivating plugins, toggling CDN settings, or editing configuration files directly on a production server. This trial-and-error approach frequently obscures the original fault, creates new secondary conflicts, or results in irreversible data loss.

Professional troubleshooting relies on a deterministic order of operations: establish safeguards, inspect existing telemetry, isolate application layers, verify backend infrastructure, and systematically re-enable services under strict verification. Following this structured workflow isolates root causes rapidly while keeping customer data and site availability protected.

Phase 1: Safeguards and Staging Isolation

Before modifying files, database tables, or server settings, you must lock in your baseline. Troubleshooting on a live production environment risks cart abandonment, corrupted transactions, and broken SEO indexing.

  • Generate an immediate snapshot: Create an independent, full-site backup containing all core files, wp-content (plugins, themes, uploads), and an uncorrupted database dump. Do not rely solely on automated nightly backups that might have already captured the broken state.
  • Spin up a staging instance: Whenever possible, replicate the issue on an isolated staging clone. Debugging on staging allows you to activate verbose logging, switch themes, and disable security layers without exposing customer data or error traces to public visitors.
  • Put live stores into maintenance mode: If testing must occur in production—especially on WooCommerce or membership platforms—place the site in temporary maintenance mode to prevent customers from executing transactions during table optimizations or plugin restarts.

Phase 2: Built-in Telemetry and Safe Inspection

Before disabling components, review WordPress's native diagnostic tooling to collect baseline performance and environment data without introducing invasive changes.

Site Health Tool

Located in Tools > Site Health, this interface assesses critical environmental metrics, including PHP version status, database engine compatibility, JSON extension support, memory allocation, and REST API functionality. Check the Info tab for exact server parameters (such as post_max_size and upload_max_filesize) before attempting memory or execution tweaks.

Health Check & Troubleshooting Plugin

Maintained by the WordPress.org community, the official Health Check plugin provides a specialized "Troubleshooting Mode." This mode temporarily runs a clean vanilla session—deactivating all plugins and falling back to a default theme (like Twenty Twenty-Four) strictly for the logged-in administrator. Public visitors continue to view the site normally, allowing you to confirm whether an active theme or plugin is responsible without taking the site offline.

Phase 3: Isolation Matrix for Themes and Plugins

Software conflicts account for the majority of runtime errors, blank screens (White Screen of Death), and broken administrative dashboards. Pinpointing the responsible component requires a systematic elimination strategy rather than random deactivation.

Isolation Strategy Primary Use Case Diagnostic Mechanism
Binary Search (Divide & Conquer) Sites with 20+ active plugins Deactivate 50% of plugins. If the bug resolves, the culprit is in that batch. Re-test halves until isolated.
Theme Switch Fallback Visual breaks, template errors, REST API blocks Switch to a default core theme (e.g., Twenty Twenty-Four). If fixed, inspect the child theme's functions.php.
FTP / CLI Rename Override Admin dashboard inaccessible (Lockout / 500 Error) Temporarily rename wp-content/plugins to wp-content/plugins_old to force deactivation.
Drop-in & Must-Use Inspection Persistent errors after standard deactivation Inspect and rename files in wp-content/mu-plugins and drop-ins like object-cache.php or advanced-cache.php.

If you have SSH access, you can manage and inspect plugins rapidly via the official WP-CLI plugin command suite:

# List status of all installed plugins
wp plugin list

# Deactivate all plugins simultaneously
wp plugin deactivate --all

# Reactivate a specific plugin for testing
wp plugin activate woocommerce

Phase 4: Debug Logging Configuration

When the visual interface reveals only a vague "There has been a critical error on this website," enabling backend PHP logging surfaces the exact script, file name, and line number causing the fatal condition.

Warning: Never leave WP_DEBUG_DISPLAY enabled on a production website. Exposing raw PHP errors publicly reveals file paths, environment keys, and server infrastructure details to bad actors.

To safely write errors to a hidden log file without displaying them on the front end, open wp-config.php using SFTP, SSH, or your host's file manager. Locate the line that says /* That's all, stop editing! Happy publishing. */ and add the following configuration directly above it according to the WordPress Debugging Documentation:

// Enable standard debug mode
define( 'WP_DEBUG', true );

// Direct output to wp-content/debug.log
define( 'WP_DEBUG_LOG', true );

// Prevent errors from rendering on the live page
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Load unminified core JavaScript and CSS (optional for frontend script debugging)
define( 'SCRIPT_DEBUG', true );

Trigger the problematic action on your site, then open /wp-content/debug.log. Review the stack trace starting from the bottom upward to identify the offending plugin, theme file, or database query. Once diagnostics are complete, revert WP_DEBUG to false to prevent oversized log files from exhausting disk space.

Phase 5: Database Connection and Integrity Checks

An "Error Establishing a Database Connection" message means PHP cannot communicate with the MySQL/MariaDB daemon. This failure stems from one of three areas: credential mismatches, server resource exhaustion, or table corruption.

1. Validate Database Credentials

Inspect the connection constants defined in wp-config.php:

  • DB_NAME: Database name
  • DB_USER: Database username
  • DB_PASSWORD: Database user password
  • DB_HOST: Host destination (frequently localhost, but often an internal IP or specific port on managed cloud platforms)

Verify these details against your web hosting control panel or test the credentials via SSH using the MySQL command-line client or WP-CLI database commands:

wp db check

2. Corrupted Table Repair

Warning: Back up your database before running repair utilities. If a table index has collapsed under write load, automated repairs modify table structures immediately.

If the site admin reports that certain tables are missing or crashed, WordPress provides an automatic repair script. Add this line to wp-config.php:

define( 'WP_ALLOW_REPAIR', true );

Navigate to https://example.com/wp-admin/maint/repair.php in your browser and run the "Repair Database" routine. Alternatively, execute the command via WP-CLI:

wp db repair

Crucial Security Step: The repair script is accessible without authentication. As soon as the repair finishes, delete the WP_ALLOW_REPAIR line from wp-config.php.

Phase 6: PHP Engine and Server Resource Verification

Memory exhaustion and script timeouts generate silent 500 Internal Server Errors or incomplete page renders. These issues happen when complex themes, heavy page builders, or bulk imports exceed PHP's configured boundaries.

Diagnosing Memory Exhaustion

Inspect your debug.log or host error logs for this signature entry:
Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)

To raise the limit allocated to WordPress tasks, add the following directive to wp-config.php above the final comment line:

define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

Server-Level Directives

If changes in wp-config.php are overridden by the server, adjust your environment through .user.ini, php.ini, or your hosting control panel's PHP selector:

memory_limit = 256M
max_execution_time = 300
upload_max_filesize = 64M
post_max_size = 64M

Confirm the new limits took effect by checking Tools > Site Health > Info > Server.

Phase 7: Routing, Permalinks, and Server Rules

When the homepage loads correctly but individual posts, custom post types, or REST API endpoints return 404 Not Found errors, the web server's URL rewrite rules are out of sync with WordPress routing.

Regenerating Permalinks

  1. Log in to the WordPress dashboard.
  2. Navigate to Settings > Permalinks.
  3. Do not change any settings; click Save Changes at the bottom of the page.

This action flushes and rewrites the internal rewrite array. If using WP-CLI, run:

wp rewrite flush --hard

Validating Server Configuration Files

If the web server lacks write permissions, WordPress cannot automatically update your rewrite configuration.

  • Apache: Ensure a .htaccess file exists in the WordPress root directory with standard permissions (typically 644). If modified by security or caching plugins, restore the default WordPress rules as documented in the WordPress .htaccess Handbook:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
  • Nginx: Nginx does not use .htaccess files. Ensure your virtual host configuration contains the standard directive: try_files $uri $uri/ /index.php?$args;.

Phase 8: Background Tasks (WP-Cron) and Transactional Email

Issues such as missed scheduled posts, delayed WooCommerce notifications, and forgotten password emails failing to arrive stem from execution failures in either the internal scheduler (WP-Cron) or PHP's default mail transport.

Troubleshooting WP-Cron

By default, WordPress executes internal cron jobs on page loads using pseudo-cron. On low-traffic sites, scheduled tasks stall; on high-traffic sites, multiple concurrent visits can spawn duplicate cron runners.

  • Check Tools > Site Health for cron execution warnings.
  • If your host has blocked loopback connections, pseudo-cron cannot run. Test your loopback status under the Site Health status list.
  • Enterprise Best Practice: Disable default pseudo-cron in wp-config.php:
define( 'DISABLE_WP_CRON', true );

Then configure a system cron job through your server crontab to run every 5 to 10 minutes:

*/10 * * * * wget -q -O - https://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
# Or via WP-CLI:
*/10 * * * * cd /path/to/wordpress && wp cron event run --due-now >/dev/null 2>&1

Diagnosing Transactional Email Deliverability

WordPress uses PHP's basic mail() function by default via wp_mail(). Most shared hosting servers lack correct Sender Policy Framework (SPF), DomainKeys Identified Mail (DKIM), and DMARC records for direct server-generated mail, causing outbound messages to be rejected by recipient mail servers.

  1. Install a dedicated SMTP plugin or API transport plugin (e.g., SendGrid, Postmark, Mailgun, Amazon SES).
  2. Configure SMTP authentication using an off-server transactional email service provider.
  3. Send a test email using the plugin's built-in testing interface to inspect SMTP handshake logs, TLS encryption, and response codes.

Phase 9: Multi-Tier Caching and CDN Layers

A fix may be deployed correctly at the code level, yet browser testing continues to show broken behavior due to stale caching layers. Troubleshooting requires flushing each tier in the proper structural order: innermost application layers first, outward to edge networks.

  1. Object Cache / Transients: Flush Redis or Memcached instances. If using WP-CLI: wp cache flush.
  2. WordPress Page Cache: Clear the cache generated by optimization plugins (e.g., WP Rocket, LiteSpeed Cache, W3 Total Cache).
  3. Server-Level Reverse Proxy: Purge Nginx FastCGI, Varnish, or host-managed caching via your hosting panel.
  4. Content Delivery Network (CDN): Purge edge cache via the Cloudflare, Fastly, or CloudFront control panels. Enable CDN "Development Mode" to bypass edge proxy caching temporarily during code isolation.
  5. Local Browser Cache: Open an incognito/private window or perform a hard refresh (Ctrl+F5 or Cmd+Shift+R) with Developer Tools configured to "Disable cache."

Phase 10: Final Verification and Operational Hand-off

Once the root cause is resolved, complete a comprehensive validation pass before returning the site to regular production status.

Production Readiness Checklist

  • [ ] Disable Verbose Debugging: Verify that WP_DEBUG, WP_DEBUG_DISPLAY, and temporary script debugging are set to false in wp-config.php.
  • [ ] Remove Maintenance and Repair Constants: Ensure WP_ALLOW_REPAIR is completely deleted from configuration files.
  • [ ] Purge Debug Artifacts: Delete or truncate /wp-content/debug.log so sensitive error paths do not remain accessible on the server.
  • [ ] End Troubleshooting Sessions: Deactivate Troubleshooting Mode in the Health Check plugin to restore normal theme and plugin execution for administrative sessions.
  • [ ] Execute End-to-End User Flow Tests: Verify that user login, contact forms, cart additions, payment gateway processing, and REST API calls function cleanly.
  • [ ] Re-enable Live Caching and CDN Rules: Turn off CDN Development Mode and confirm that your page caching engine is actively generating updated static assets.
  • [ ] Create a Post-Resolution Snapshot: Take a final clean backup to serve as your new stable operational baseline.

Sources & References