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.
- 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.
- The wp-config.php file is located in the root directory of your web server
- 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.
- 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. */
- Change the WP_DEBUG mode from false to true.
// Enable WP_DEBUG mode
define( ‘WP_DEBUG’, true );
- Add WP_DEBUG_DISPLAY as indicated below
// Enable display of errors and warnings
define( ‘WP_DEBUG_DISPLAY’, true );
- 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.
- Save the changes that you have just made to your wp-config.php file.
- Visit your website, refresh the screen and any errors will be displayed directly on-screen.
- 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.