Skip to content

How to Debug WordPress

Enable WP_DEBUG, use Query Monitor, read PHP logs, inspect the browser console, and tackle the white screen of death.

WordPress issues—from white screens to plugin conflicts—are easiest to resolve with logging enabled and display turned off for visitors. This guide shows how to enable WP_DEBUG safely, read logs, and use built-in Site Health on SerVee IT hosting.

Enable WP_DEBUG Safely

Edit 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 );
@ini_set( 'display_errors', 0 );

Logs write to wp-content/debug.log. Official reference: Debugging in WordPress.

Warning: Never leave WP_DEBUG_DISPLAY as true on production—it exposes paths and stack traces to visitors.

Read the Debug Log

tail -n 50 /var/www/vhosts/example.com/httpdocs/wp-content/debug.log

Reproduce the error in the browser, then refresh the log. Look for PHP fatal errors, undefined functions, and memory exhaustion.

Site Health

In wp-admin, open Tools → Site Health. Review critical issues: PHP version, persistent object cache, background updates, and HTTPS. See Site Health screen.

Isolate Plugins and Theme

Disable Plugins via Database

If wp-admin is inaccessible, rename the plugins folder via FTP/SSH (see rename plugin folder guide) or clear active plugins in the database:

wp plugin deactivate --all --path=/var/www/vhosts/example.com/httpdocs

Switch Theme

wp theme activate twentytwentyfour --path=/var/www/vhosts/example.com/httpdocs

Increase Logging Detail (Temporary)

define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );

Remove or set to false after diagnosis to avoid performance impact.

Tip: Pair WordPress debug.log with server PHP-FPM and web server error logs for complete context.

Staging and Core Files

Compare checksums if core files may be corrupted:

wp core verify-checksums --path=/var/www/vhosts/example.com/httpdocs

Reinstall core without touching content:

wp core download --force --skip-content --path=/var/www/vhosts/example.com/httpdocs

Turn Off Debug on Production

define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false );

Delete or archive large debug.log files after fixing the issue.

Summary

Enable WP_DEBUG_LOG with display off, tail debug.log, use Site Health, and isolate plugins/themes with wp-cli or folder renames. Disable debug when finished. SerVee IT managed WordPress support can assist with log review and staging reproduction.