WordPress features a designated debugging system and uniform coding practices across its core, plugins, and themes to facilitate the detection of PHP errors. Activating this debugging mode will result in the display of all PHP errors and warnings, allowing you to identify any issues with your site.
WP_DEBUG is a PHP constant (a permanent global variable) used to enable the “debug” mode throughout WordPress. By default, it is set to false, but it’s commonly changed to true in the wp-config.php file for development versions of WordPress.
Required: You will require the following items to finish the procedures:
- An FTP client to access your site files. There are many third-party FTP clients available, we recommend the Filezilla FTP client.
- A text editor to make the necessary changes to the file. There are many third-party text editors available, we recommend Notepad++. Do not edit with a word processing application like Microsoft Word.
- Connect with an FTP client or use a file manager to edit the wp-config.php for your website.
- Change
WP_DEBUG
from false to true:
define( ‘WP_DEBUG’, false );
With debugging enabled:
define( ‘WP_DEBUG’, true ); - On the following line, type:
define( ‘WP_DEBUG_LOG’, true ); - Once you’re done making changes, save the file. If you’re using FileZilla, accept the overwrite warning in FileZilla to replace the file.
- Use your internet browser to visit your site, this will allow the debug log to save errors.
- Using the same editor, open the file that was created by step 5, the
/wp-content/debug.log
file. - Review the contents of the debug log to identify the problem to a specific plugin, theme, or configuration option that might be causing a problem.
Note: The true and false values in the example are not surrounded by apostrophes (‘) because they are boolean (true/false) values. If you set constants to ‘false’, they will be interpreted as true because the quotes make it a string rather than a boolean.
Warning: It is advisable not to use WP_DEBUG or other debugging tools on production sites; these tools are designed for use in local testing and staging environments. Once you finish troubleshooting, make sure to turn off debug mode. Keeping debug mode on can lead to potential security vulnerabilities for your site.
Thanks for visiting. For queries and suggestions, emails are welcome at learnweb@hostingcolumn.com.
Subscribe to Hosting Column for the latest updates and posts.