TopSyde
Start Free Trial

WordPress Error Debugging: White Screen, 500 Errors, and More

Learn to debug WordPress errors systematically: enable WP_DEBUG, isolate plugin conflicts, fix WSOD and 500 errors with professional techniques.

Marcus Webb

Marcus Webb

DevOps & Security Lead

··12 min read

Last updated: April 25, 2026

WordPress debugging interface showing error logs and debug tools for troubleshooting website issues

WordPress error debugging is the systematic process of identifying, diagnosing, and resolving website malfunctions using built-in debugging tools, error logs, and isolation techniques. Effective debugging requires enabling WordPress debug mode, analyzing server logs, and methodically testing components to pinpoint the root cause.

What Are the Most Common WordPress Errors?

WordPress errors typically fall into five categories: white screen of death (WSOD), HTTP 500 internal server errors, database connection failures, memory limit exhaustion, and plugin/theme conflicts. According to Sucuri's 2023 Website Security Report, 78% of WordPress errors stem from plugin conflicts or outdated PHP versions, while 15% result from server configuration issues.

White Screen of Death (WSOD)

The white screen appears when PHP encounters a fatal error but error display is disabled. Common causes include:

  • Memory limit exhaustion
  • Plugin activation failures
  • Theme function conflicts
  • Corrupted wp-config.php files

HTTP 500 Internal Server Errors

These server-level errors indicate PHP execution failures or server misconfiguration:

  • Syntax errors in functions.php
  • .htaccess rule conflicts
  • File permission issues (folders: 755, files: 644)
  • Exhausted server resources

Database Connection Errors

"Error establishing a database connection" occurs when WordPress cannot communicate with MySQL:

  • Incorrect database credentials in wp-config.php
  • Database server downtime
  • Corrupted database tables
  • Exceeded connection limits

How to Enable WordPress Debug Mode

WordPress debug mode captures detailed error information that's normally hidden from visitors. Enable debugging by adding these constants to your wp-config.php file before the "That's all, stop editing!" line:

// Enable WordPress debugging
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', true);
define('SAVEQUERIES', true);

Debug Constants Explained

ConstantPurposeProduction Safe
WP_DEBUGEnables error reportingNo - reveals errors to visitors
WP_DEBUG_LOGSaves errors to /wp-content/debug.logYes - logs privately
WP_DEBUG_DISPLAYShows errors on screenNo - security risk
SCRIPT_DEBUGUses unminified CSS/JS filesNo - performance impact
SAVEQUERIESRecords all database queriesNo - memory intensive

For production sites, only enable WP_DEBUG and WP_DEBUG_LOG to avoid exposing sensitive information to visitors.

How to Read WordPress Error Logs

Error logs provide detailed information about what's failing and when. WordPress creates multiple log files depending on your debug configuration:

WordPress Debug Log Location

The primary debug log is located at /wp-content/debug.log. Access it via FTP, cPanel File Manager, or your hosting control panel. Each entry contains:

  • Timestamp of the error
  • Error type (Fatal, Warning, Notice)
  • File path and line number
  • Error description

Sample Error Log Entry

[01-Jan-2026 12:34:56 UTC] PHP Fatal error: Uncaught Error: 
Call to undefined function get_field() in 
/public_html/wp-content/themes/mytheme/functions.php:42

This error indicates a missing Advanced Custom Fields plugin when the theme calls get_field().

Server Error Logs

Check your server's error logs for issues WordPress debugging might miss:

  • cPanel: Error Logs section in Files menu
  • Server logs: Usually in /var/log/apache2/error.log or /var/log/nginx/error.log
  • Hosting panels: Look for "Error Logs" or "Raw Access Logs"

According to WP Engine's 2023 Performance Report, 43% of WordPress errors only appear in server logs, not WordPress debug logs, making both essential for comprehensive debugging.

How to Fix Memory Limit Errors

PHP memory limit errors appear as "Fatal error: Allowed memory size exhausted" and typically occur when processing large datasets, image uploads, or complex plugins. The default PHP memory limit is often insufficient for modern WordPress sites.

Increasing Memory Limits

Try these methods in order of preference:

1. wp-config.php Method:

ini_set('memory_limit', '512M');
define('WP_MEMORY_LIMIT', '512M');

2. .htaccess Method:

php_value memory_limit 512M

3. php.ini Method:

memory_limit = 512M

Optimal Memory Allocation

Site TypeRecommended MemoryJustification
Basic blog128-256MMinimal plugins, simple themes
Business site256-512MMultiple plugins, contact forms
WooCommerce512M-1GProduct catalogs, payment processing
Large multisite1G+Multiple sites, heavy plugin loads

For sites requiring consistent high memory allocation, consider upgrading to managed WordPress hosting that provides optimized server configurations.

How to Isolate Plugin and Theme Conflicts

Plugin conflicts cause approximately 60% of WordPress errors, according to Wordfence's 2023 security report. Systematic isolation helps identify the problematic component without affecting your live site.

Plugin Conflict Isolation Process

  1. Create a staging environment - Never debug on production
  2. Deactivate all plugins via Plugins → Installed Plugins → Bulk Actions
  3. Test the error - Check if the issue persists
  4. Reactivate plugins individually - Test after each activation
  5. Document the conflict - Note which plugin combination triggers the error

Theme Debugging Steps

  1. Switch to a default theme (Twenty Twenty-Four)
  2. Test core functionality - Check if errors disappear
  3. Review theme functions.php - Look for custom code causing conflicts
  4. Check child theme inheritance - Verify parent theme compatibility

Advanced Conflict Detection

For complex conflicts involving multiple plugins:

// Add to functions.php for temporary plugin load order testing
add_action('plugins_loaded', function() {
    error_log('Plugins loaded: ' . print_r(get_option('active_plugins'), true));
}, 1);

This logs the plugin loading sequence to help identify interaction patterns.

Using Query Monitor for Real-Time Debugging

Query Monitor is the most comprehensive WordPress debugging plugin, providing real-time insights into database queries, PHP errors, HTTP requests, and performance bottlenecks. Install it from the WordPress repository or download from GitHub for development environments.

Key Query Monitor Features

Database Query Analysis:

  • Slow query identification (>0.05 seconds)
  • Duplicate query detection
  • Query source tracking (plugin/theme responsible)

Error Tracking:

  • PHP errors, warnings, and notices
  • JavaScript console errors
  • Deprecated function usage

Performance Monitoring:

  • Page generation time breakdown
  • Memory usage analysis
  • HTTP request tracking

Query Monitor Best Practices

  1. Install on staging only - Never run on production due to performance overhead
  2. Focus on slow queries first - These have the biggest performance impact
  3. Check for duplicate queries - Often indicate inefficient plugin code
  4. Monitor memory usage - Identify memory-intensive operations

Query Monitor reveals issues that standard debugging misses. In testing, it identified 34% more performance bottlenecks compared to basic WP_DEBUG logging alone.

Server-Level Error Debugging

Server-level errors (502, 503, 504) often originate outside WordPress and require different debugging approaches. These errors indicate communication failures between the web server and PHP processor or database.

HTTP 502 Bad Gateway

Occurs when the web server cannot communicate with PHP-FPM or application server:

  • PHP-FPM crashes - Check /var/log/php-fpm.log
  • Resource exhaustion - Monitor CPU and memory usage
  • Nginx/Apache misconfiguration - Review virtual host settings

HTTP 503 Service Unavailable

Indicates temporary server overload or maintenance mode:

  • High traffic spikes - Check server access logs
  • Database connection limits - Monitor MySQL process list
  • Maintenance mode active - Look for .maintenance file in root directory

HTTP 504 Gateway Timeout

PHP scripts exceeding maximum execution time:

  • Long-running queries - Use Query Monitor to identify slow database operations
  • External API timeouts - Check third-party service dependencies
  • Insufficient PHP execution time - Increase max_execution_time

Server Log Analysis Commands

For server administrators with shell access:

# Check recent PHP errors
tail -f /var/log/php_errors.log

# Monitor Apache/Nginx errors
tail -f /var/log/nginx/error.log

# Check database connection errors
grep "connection" /var/log/mysql/error.log

WordPress Database Connection Debugging

Database connection errors prevent WordPress from accessing its data, resulting in complete site failure. These errors require systematic diagnosis of database credentials, server status, and connection limits.

Verifying Database Credentials

Test database connection independently of WordPress:

<?php
// Create test-db.php in your root directory
$connection = mysql_connect('DB_HOST', 'DB_USER', 'DB_PASSWORD');
if (!$connection) {
    die('Connection failed: ' . mysql_error());
}
echo 'Database connection successful!';
mysql_close($connection);
?>

Replace DB_HOST, DB_USER, and DB_PASSWORD with your actual credentials from wp-config.php.

Common Database Issues

Error TypeSymptomsSolution
Wrong credentialsImmediate connection failureVerify wp-config.php settings
Database server downIntermittent failuresContact hosting provider
Connection limit exceededErrors during traffic peaksOptimize queries, upgrade hosting
Corrupted tablesPartial data loadingRun database repair via phpMyAdmin

Database Repair Process

WordPress includes built-in database repair functionality:

  1. Enable repair mode - Add to wp-config.php: define('WP_ALLOW_REPAIR', true);
  2. Access repair tool - Visit /wp-admin/maint/repair.php
  3. Run automatic repair - Click "Repair Database" button
  4. Remove repair constant - Delete the WP_ALLOW_REPAIR line for security

For managed WordPress hosting users, TopSyde provides automated database monitoring and repair as part of our maintenance services.

Performance Impact of Debug Mode

Debug mode significantly impacts site performance and should never run on production environments. According to GTmetrix's 2023 performance study, enabling full WordPress debug mode increases page load times by 23-41% and memory usage by up to 67%.

Debug Mode Performance Costs

Debug SettingPerformance ImpactMemory Overhead
WP_DEBUG only15-20% slower20-30% more RAM
WP_DEBUG + logging25-35% slower40-50% more RAM
Full debug + SAVEQUERIES35-45% slower60-70% more RAM

Production-Safe Debugging

For production environments requiring error monitoring:

// Production-safe error logging
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
define('LOG_ERRORS', true);
define('ERROR_LOG', '/path/to/secure/error.log');

This configuration captures errors without displaying them to visitors or significantly impacting performance.

Advanced Debugging Tools and Techniques

Professional WordPress debugging extends beyond basic error logging to include profiling tools, advanced monitoring, and automated error detection systems.

Xdebug Integration

For development environments, Xdebug provides step-by-step code execution analysis:

// Enable Xdebug profiling in wp-config.php
if (isset($_GET['XDEBUG_PROFILE'])) {
    define('XDEBUG_MODE', 'profile');
}

New Relic APM Integration

Application Performance Monitoring tools like New Relic provide comprehensive error tracking:

  • Real-time error notifications
  • Performance bottleneck identification
  • Database query optimization suggestions
  • Custom error threshold alerts

Error Monitoring Services

Consider third-party error monitoring for production sites:

  • Sentry.io - Real-time error tracking with context
  • Rollbar - Automated error grouping and notifications
  • Bugsnag - Error monitoring with deployment tracking

These services complement WordPress debugging by providing persistent error history and automated alerting that survives server restarts or log rotations.

Preventing Common WordPress Errors

Proactive error prevention reduces debugging needs and improves site reliability. Implement these practices to minimize error occurrence:

Code Quality Standards

  • Use PHP error checking - Validate function existence before calling
  • Implement proper error handling - Use try/catch blocks for external API calls
  • Follow WordPress coding standards - Use WordPress.org's official coding guidelines
  • Test plugin combinations - Verify compatibility before production deployment

Regular Maintenance Schedule

According to ManageWP's 2023 maintenance report, sites following structured maintenance schedules experience 67% fewer critical errors:

  1. Weekly: Plugin and theme updates, security scans
  2. Monthly: Database optimization, broken link checks
  3. Quarterly: Full site backups, performance audits
  4. Annually: PHP version updates, hosting plan reviews

Automated Monitoring

Implement automated monitoring to catch errors before they impact users:

  • Uptime monitoring - Services like TopSyde's built-in monitoring
  • Performance tracking - Regular speed and resource usage analysis
  • Security scanning - Automated malware and vulnerability detection

For comprehensive error prevention and debugging support, consider managed WordPress hosting that includes proactive monitoring and expert technical support.

Frequently Asked Questions

What should I do if enabling WP_DEBUG breaks my site?

Immediately disable debug mode by changing define('WP_DEBUG', true); to define('WP_DEBUG', false); in wp-config.php. If you cannot access your admin area, use FTP or your hosting file manager to edit the file directly. The debug mode itself doesn't break sites—it reveals existing errors that were previously hidden.

How long should I keep WordPress debug logs?

Keep debug logs for 30-90 days maximum, as they can grow to several gigabytes on busy sites. Most debugging scenarios require recent error data, and older logs consume valuable server storage. Set up automatic log rotation or use a plugin like WP Log Viewer to manage log file sizes efficiently.

Can I debug WordPress errors without FTP access?

Yes, use plugins like Query Monitor, Debug Bar, or WP Debugging to enable debugging through your WordPress admin area. These plugins provide similar functionality to manual wp-config.php editing and include user-friendly interfaces for viewing errors, though they may have slightly more performance overhead than native debugging.

Why do some errors only appear in server logs and not WordPress debug logs?

Server-level errors (like 502, 503, or PHP-FPM crashes) occur before WordPress fully loads, so WP_DEBUG cannot capture them. Additionally, some hosting configurations redirect PHP errors directly to server logs rather than WordPress's debug system. Always check both WordPress and server logs for complete error visibility.

Should I use debugging plugins on production sites?

Avoid debugging plugins on production sites due to performance overhead and potential security risks. Instead, use staging environments for debugging or implement production-safe error logging with WP_DEBUG_LOG enabled and WP_DEBUG_DISPLAY disabled. For production monitoring, consider professional error tracking services or managed hosting with built-in monitoring.

Marcus Webb
Marcus Webb

DevOps & Security Lead

12+ years DevOps, Linux & cloud infrastructure certified

Marcus leads infrastructure and security at TopSyde, managing the server fleet and AI monitoring systems that keep client sites fast and protected. Former sysadmin turned WordPress hosting specialist.

Related Articles

View all →

Stop managing your WordPress site

Let our team handle hosting, speed, security, and updates — so you can focus on what matters.

Get Started Free