How to use WP_DEBUG

Table of Content

If you have problems with your website and need to find out what errors are causing it, the built-in method with WordPress is to use the WP_DEBUG setting.

When this feature is turned on, all errors are written to a text file that you can open and get more details from about what is causing the problem.

Keep in mind, this file can contain sensitive data about your website or server, so you should not leave this feature turned on all the time, only when fixing errors.

How to enable WP_DEBUG

Open the file wp-config.php (usually found in the root of your website) and make sure the following settings are set up, and if they do not exist add them to the file:

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

Once you have saved the changes you can go back to your website and try the same again, this time all errors should be written to the debug file, usually found in the folder /wp-content/debug.log

You can search for errors related to “security-ninja” or other errors that are preventing your website to run from other plugins. There can be plenty of notices or warnings, but it is the “FATAL” error that stops the website from fully loading.

Read more on how to prevent errors showing up in the frontend.

Remember, once you have finished debugging, turn off the debugging again by setting “WP_DEBUG” to “false”. You should also remove the debug.log file or use WP Security Ninja to block access to this file.


Was this helpful?

Next Article

Re-install WordPress