Use WP_DEBUG_LOG first when the problem looks WordPress-related, then check the PHP error log when the failure is broader, blank, or server-level. WordPress supports constants such as WP_DEBUG, WP_DEBUG_LOG, and WP_DEBUG_DISPLAY inside wp-config.php, which makes its own logging useful for theme, plugin, and core warnings [source: WordPress Developer Resources]. PHP error logs sit closer to the server and catch fatal errors, memory failures, permission issues, and configuration problems that WordPress may never display.
TLDR: WP_DEBUG_LOG is best for finding plugin, theme, and WordPress code problems, while PHP error logs are better for server-wide failures and fatal crashes. For example, if a checkout page starts throwing a 500 error after a plugin update, WP_DEBUG_LOG may show the exact plugin file and line number. In one typical agency workflow, checking the WordPress debug log first can cut a 30-minute guessing session down to 5 minutes when the fault is inside a plugin. If the log stays empty, the PHP error log should be the next stop.
What WP_DEBUG_LOG Actually Does
WP_DEBUG_LOG tells WordPress to write debug messages to a log file. In many setups, that file is created at wp-content/debug.log. It works with WP_DEBUG, so both must be set correctly.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
This setup keeps errors off the public site while still recording them. That matters. Visitors should not see file paths, database messages, or plugin warnings. Honestly, it feels like a tiny setting until a live site starts printing errors across the header.
WP_DEBUG_LOG is most useful for:
- Plugin conflicts after an update
- Theme function errors
- Deprecated WordPress functions
- PHP notices and warnings triggered by WordPress code
- WooCommerce, form, membership, and builder plugin issues
For a site owner, the value is simple. The log often points to a file path, line number, and error type. Instead of switching off plugins one by one for an hour, a developer can see that some-plugin/includes/cart.php caused the issue.
What PHP Error Logs Do Differently
PHP error logs are generated at the hosting or server level. They are not limited to WordPress. They may capture errors from any PHP script running on the account. Their location changes by host. A log may appear in cPanel, Plesk, a hosting dashboard, /var/log/, or a site-specific folder.
PHP error logs are better for:
- HTTP 500 errors before WordPress loads
- Memory exhaustion, such as
Allowed memory size exhausted - PHP version conflicts
- File permission problems
- Missing extensions, such as
imagickormbstring - Fatal errors that stop execution too early for WordPress logging
The annoying part is access. Some hosts make PHP logs easy to find. Others bury them three menus deep or require support. Expect to waste time on this the first time a hosting panel changes its layout without warning.
WP_DEBUG_LOG vs PHP Error Logs: The Practical Difference
The main difference is where the error is caught. WP_DEBUG_LOG works inside the WordPress application. PHP error logs work closer to the server runtime.
| Feature | WP_DEBUG_LOG | PHP Error Log |
|---|---|---|
| Best for | WordPress themes, plugins, hooks | Server, PHP runtime, fatal crashes |
| Common location | wp-content/debug.log |
Hosting panel or server log folder |
| Control | Set in wp-config.php |
Set by PHP config or host |
| Ease of access | Usually simple with file access | Depends on hosting provider |
| Security risk | Public file risk if exposed | Usually less public, but still sensitive |
When to Use WP_DEBUG_LOG First
A developer should start with WP_DEBUG_LOG when the site still loads, even partly. It is also the right first choice after a plugin update, custom code change, theme edit, or WordPress upgrade.
Good signals include:
- The admin area works, but one page fails
- A form stopped sending emails
- A shortcode displays broken output
- A specific plugin screen shows a warning
- The issue began right after a WordPress-related change
For example, a membership site may show a blank account page after an add-on update. WP_DEBUG_LOG might show a fatal error in that add-on’s template override. That gives the developer a direct path: disable the add-on, patch the file, or roll back the version.
When PHP Error Logs Should Come First
PHP error logs should be checked first when WordPress cannot even start. A white screen before the homepage loads, repeated 500 errors, or a broken login screen may all point to a lower-level failure.
They are also useful when the WordPress log is empty. An empty debug log does not mean nothing happened. It may mean the error occurred before WordPress could write anything.
Common examples include:
PHP Fatal error: Allowed memory size exhaustedUncaught Error: Call to undefined functionFailed opening required filePermission deniedPHP Parse errorfrom a bad code edit
These messages tend to be blunt, but useful. They often show if the server is running an unsupported PHP version or missing a required module.
Security Rules for Error Logs
Error logs can expose sensitive details. They may reveal server paths, usernames, database table names, plugin names, and private file locations. A site owner should never leave a public debug log exposed.
Basic safety steps include:
- Set
WP_DEBUG_DISPLAYtofalseon live sites - Delete old debug logs after fixing the issue
- Block browser access to
debug.logif needed - Never share full logs in public forums without redacting paths and tokens
- Turn off
WP_DEBUGafter troubleshooting
A public debug.log file can become a quiet security problem. If it is indexed or guessed, attackers may learn which plugins are installed and which files are throwing errors.
A Simple Troubleshooting Workflow
A practical workflow keeps the process short:
- Reproduce the issue. Visit the broken page or repeat the failed action.
- Check WP_DEBUG_LOG. Look for fresh timestamps and plugin or theme paths.
- Check the PHP error log. Look for fatal errors and server messages.
- Match timestamps. The right error usually appears at the exact failure time.
- Test one fix at a time. Disable a plugin, switch theme, raise memory, or patch code.
- Clear caches and retest. Cached pages can hide the result.
- Turn logging back off. Keep the site clean after repair.
Which Log Is Better?
Neither log is “better” in every case. WP_DEBUG_LOG is better for WordPress-level clues. PHP error logs are better for server-level truth. The fastest troubleshooting usually uses both.
If the error mentions a plugin file, theme file, hook, or deprecated function, the WordPress log will usually be more readable. If the error mentions memory, permissions, missing files, or PHP modules, the PHP log may be more useful.
The key is not to stare at one log forever. If one source gives no fresh clue in a few minutes, the other should be checked. That small switch often saves the most time.
FAQ
Where is the WordPress debug log located?
It is usually located at wp-content/debug.log when WP_DEBUG and WP_DEBUG_LOG are enabled. Some custom setups may send it elsewhere.
Can WP_DEBUG_LOG slow down a website?
It can add overhead if many errors are written constantly. On a healthy site, the impact is usually small. On a broken site producing thousands of notices, it can grow large and messy.
Should WP_DEBUG be left on all the time?
No. On a live site, it should be used only during troubleshooting. If logging is needed longer, display should stay off and access to the log should be protected.
Why is the WordPress debug log empty?
The error may happen before WordPress loads. Logging may also be configured wrong, file permissions may block writing, or the issue may sit at the server level.
Who should read PHP error logs?
A developer, host support agent, or technical site manager should review them. The messages can be dense, but they often expose the exact cause of a fatal error.




