How to turn on WordPress debug mode and read debug.log
To turn on WordPress debug mode, edit wp-config.php and set WP_DEBUG and WP_DEBUG_LOG to true, and WP_DEBUG_DISPLAY to false. Errors will then be written to wp-content/debug.log, without appearing to visitors. When you finish, set WP_DEBUG back to false and delete the log, because it reveals server paths and details.
Before you begin
- You need access to cPanel to use the File Manager. The WordPress dashboard does not need to be working.
- Download a copy of
wp-config.phpbefore editing. A typo in this file can take the site offline, and the copy lets you undo the change. - Have a recent backup. The backup in cPanel with JetBackup runs automatically at MigraCloud, and you restore it yourself.
What each constant does
| Constant | Value | Function |
|---|---|---|
WP_DEBUG |
true |
Turns on debug mode and records errors and warnings |
WP_DEBUG_LOG |
true |
Writes the messages to wp-content/debug.log |
WP_DEBUG_DISPLAY |
false |
Prevents errors from appearing on screen to visitors |
Step by step: turn on debugging
- In cPanel, open the File Manager and go to your site’s folder (on a main domain, this is usually
public_html). - Right-click
wp-config.phpand choose Edit. - Look for the line
define( 'WP_DEBUG', false );and replace it. If it does not exist, insert the lines above the comment/* That's all, stop editing! */. - Use these three lines, without repeating any of them in the file:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
- Save the file and repeat the problem: open the page with the error or activate the suspect plugin.
- Open the
wp-contentfolder and look fordebug.log. It only appears after the first error is recorded.
How to read debug.log
Each line includes the date and time, the type of error, the message, the file, and the line number. The newest entries are at the end, so start there:
[22-Nov-2026 10:15:32 UTC] PHP Fatal error: Uncaught Error: Call to undefined function exemplo() in /home/usuario/public_html/wp-content/plugins/nome-do-plugin/arquivo.php:42
The part that matters is wp-content/plugins/nome-do-plugin/: the fault is in that plugin.
Where to find the cPanel error logs
debug.log only shows what WordPress is able to record. Errors that stop PHP before that can go somewhere else:
- Errors, in cPanel (under Metrics): shows the latest lines of the domain’s log, without having to look for the file.
error_logfile: PHP usually creates it in the folder where the error occurred, such as the site root,wp-admin, andwp-content. Turn on the option to show hidden files in the File Manager.
How to interpret the most common messages
| Message | What it means | Where to start |
|---|---|---|
PHP Fatal error |
A serious error that stopped execution | The file path on the same line shows whether it is a plugin, a theme, or the core |
Allowed memory size of ... bytes exhausted |
PHP reached its memory limit | See which plugin was running at the time; only raise the limit after you find the cause |
Call to undefined function ... |
The code called a function that does not exist | An incompatible plugin or theme for your WordPress or PHP version, or another required plugin is deactivated |
Parse error: syntax error |
A writing error in the code | Almost always a snippet pasted incorrectly into functions.php or into a file edited by hand |
Deprecated and Notice |
Warnings about old code | Usually ignored if the site works |
How to find the culprit plugin or theme
- In
debug.log, locate the line with the error and read the file path. - If it contains
wp-content/plugins/plugin-name/, the problem is in the plugin. If it containswp-content/themes/theme-name/, it is in the theme. - To deactivate without entering the dashboard, rename the folder in the File Manager, for example to
plugin-name-disabled. - Open the site. If the error is gone, you have found the culprit.
- Look for a newer version and check its compatibility with your site’s PHP version (see how to update the PHP version of your WordPress site). If there is no fix, replace the plugin.
If the path points to wp-includes or wp-admin, deactivate the plugins one by one until the error disappears. For the full procedure for a site that is down, see 500 error or white screen in WordPress.
After solving it: turn off debugging and delete the log
This step is not optional. debug.log stays inside wp-content and, depending on the server configuration, anyone who types its address into a browser may be able to open it. Its contents show folder paths, plugin names, and sometimes site data.
- In
wp-config.php, change the line todefine( 'WP_DEBUG', false );. You can remove the other two lines. - In
wp-content, deletedebug.log. If you need to show it to support, download a copy to your computer first. - Open
yourdomain.com/wp-content/debug.login your browser. The result should be “not found” or “access denied,” never the text of the log.
When debug.log does not appear
Repeat the action that causes the error, check that the lines are placed before the comment /* That's all, stop editing! */, and confirm that WordPress is able to write to wp-content. If nothing works, contact support and include the error message, and the date and time of the problem.
Frequently asked questions
Can I leave WP_DEBUG turned on in my site?
It is not recommended on a live site. The file grows, it can expose information, and it records warnings that do not affect how the site works. Turn it on to investigate, and turn it off when you are done.
What is the difference between debug.log and error_log?
debug.log is created by WordPress, in wp-content, when WP_DEBUG_LOG is turned on. error_log is created by PHP on the server and can record errors that happen outside WordPress. It is worth checking both.
Does increasing the memory fix the Allowed memory size error?
Sometimes it relieves the problem, but it does not fix the cause. If a plugin consumes all the memory, the best option is to identify it in the log and replace it. The maximum limit allowed depends on your plan: ask support.