If you would like to have a better understanding of errors appearing on your website or its pages, the debugging mode of WordPress will help you out!
WP_DEBUG shows you information about any error on your website happening at this moment. To enable it, open Hosting → Manage → File Manager and find your wp-config.php
file. It will be located in domains/domain.tld/public_html, where domain.tld is your domain name:
WP_DEBUG
Open the file and search for the line with 'WP_DEBUG':
define( 'WP_DEBUG', false );
If you find it, just change false
to true
, and save changes to enable it.
If there is no such line of code in your wp-config.php file, add it before this line:
/*That's all, stop editing! Happy publishing.*/
It will look like this:
WP_DEBUG_LOG
To store historical data of possible errors on your website, all you need to do is enable WP_DEBUG_LOG. To do so, add the following line on wp-config.php:
define('WP_DEBUG_LOG', true);
Below the line that enables WP_DEBUG. That’s it! Now all the errors will be logged in the debug.log file, located in your website's wp-content folder.
WP_DEBUG_DISPLAY
While WP_DEBUG enables debugging mode on your website to better track all possible errors, you might not want them to be displayed on the website. If you wish to hide the errors and be available only from the log, simply add this line below enabling WP_DEBUG:
define('WP_DEBUG_DISPLAY', false);
That's it! Now you know how to enable and disable the debugging mode for WordPress 😊
NOTES: