Skip to Content

How to Debug WordPress: Tools and Techniques

When something goes wrong (and it always does sooner or later)

A white screen. A crashing plugin. A function that stopped working after the latest update. WordPress development means debugging. The right tools make the difference between half an hour and half a day.

wp-config.php: first step

Three lines that should be enabled in every development environment:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('SCRIPT_DEBUG', true);

WP_DEBUG shows PHP errors and warnings. WP_DEBUG_LOG writes them to wp-content/debug.log instead of displaying on screen (important in production). SCRIPT_DEBUG loads uncompressed JS and CSS, making it easier to trace frontend issues.

Query Monitor

Free plugin. Shows every database query, which file and line triggered it, how long it took. HTTP requests, running hooks, conditional tags. The single most useful debug tool for WordPress.

Install it in development. Deactivate in production (it adds overhead).

Common debugging steps

Plugin conflict? Deactivate all plugins, activate one at a time. Theme problem? Temporarily switch to Twenty Twenty-Four. Database issues? wp db check and wp db repair via WP-CLI.

White screen of death? Check debug.log. Usually it's a fatal PHP error: missing function, memory exceeded, or syntax error in functions.php.

Error logging in production

Enable WP_DEBUG_LOG but set WP_DEBUG_DISPLAY to false. Errors are logged without visitors seeing them. Rotate the log regularly; it can grow fast on an active site.

Schema Markup in WordPress Without a Plugin
Structured data that Google understands