Skip to content

How to Enable Debugging in WordPress

Last modified: September 12, 2023
You are here:
Estimated reading time: 1 min

Debug mode is incredibly useful when troubleshooting a WordPress site that is showing errors or not working correctly. Enabling debug mode will almost always help you identify the root cause of the issue. This article will walk you through enabling debugging for your WordPress website.

        1. Start by locating the wp-config.php file. You will need to access your site files using either FTP software or your web host’s control panel interface.
        2. The wp-config.php file is located in the root directory of your web server
        3. Once you’ve located the wp-config.php file, open it using a text editor, code editor or your host’s control interface. Note that if you are using a text editor ensure that you are editing and saving the wp-config.php file as text. Editing the file in RTF or a Microsoft Word format will corrupt the file and break your website.
        4. The wp-config.php file contains configuration settings specific to your website, such as database information and, potentially, settings added by your hosting provider. For debugging, you’ll need to find the following text: define( ‘WP_DEBUG’, false ); – it will generally be near bottom of file, right above where it says /* That’s all, stop editing! Happy blogging. */
        5. Change the WP_DEBUG mode from false to true.

          // Enable WP_DEBUG mode
          define( ‘WP_DEBUG’, true );
        6. Add WP_DEBUG_DISPLAY as indicated below
          // Enable display of errors and warnings
          define( ‘WP_DEBUG_DISPLAY’, true );
        7. These two chunks of code will enable debugging for your website and display all errors directly on-screen. This isn’t the nicest way to view website errors, but it is the fastest and easiest. It is also possible to write the errors to a log file instead of displaying then on-screen. Google WP_DEBUG_LOG for more information on this technique.
        8. Save the changes that you have just made to your wp-config.php file.
        9. Visit your website, refresh the screen and any errors will be displayed directly on-screen.
        10. Once you have diagnosed and sorted out the issues with your website, repeat the steps above but change true to false for both chunks of code. This will disable debug more and remove all errors from displaying on your website.
Was this article helpful?
Dislike 0
Views: 9