Updated on Oct 3, 2019
If you turn on
WP_DEBUG on your WordPress website, it will give you a much better understanding of what is going on, especially in the event of an issue. Additionally, enabling
WP_DEBUG is beneficial for all theme and plugin developers that require their products to be promoted publicly by WordPress.
In this post, we will cover everything essential about
WP_DEBUG and all the ways you can make use of it for the development of your WordPress site.
You will find:
WP_DEBUG is a PHP constant. It is created with the purpose of triggering the WordPress debugging mode. You will be able to find that mode inside your
wp-config.php file. By default, the mode is disabled, but you can do many crucial tasks with it after you enable it. The main reasons to enable it are:
WP_DEBUGwill give you essential information about how to reproduce a specific issue. Via saving a log file,
WP_DEBUGrecords all activities that happen on your website, which can help in troubleshooting a problem;
WP_DEBUGwould display a deprecated functions list in all theme and plugin releases. Those are functions to be marked as inactive in the future. The notification would often let you know that there are alternatives to those functions and what exactly they are;
WP_DEBUGwhen they work on their products. This would help other developers see when there are problems and warnings, which ultimately benefits everyone save time. If a plugin or a theme is not compatible with
WP_DEBUG, the WordPress tool library is not going to endorse them.
After we have explained the general idea of what exactly
WP_DEBUG is, let’s go over its practical uses.
WP_DEBUG mode can be found in the
wp-config.php file. By default, the file’s value is set to
false.To enable it, you need to make it
true. For that, you have to use an FTP client such as FileZilla or a File Manager (via cPanel) to access the file.
In this example, we are going to use the File Manager in cPanel (my.fastcomet.com → cPanel → File Manager).
When you are in the File Manager, in the root folder of your WordPress site, you need to find your site’s
wp-config.php file (public.html/wp-config.php):
wp-config.phpand then search for
define( 'WP_DEBUG', false )
define( 'WP_DEBUG', true )
If you are unable to find the code in the site’s
wp-config.php file, you are able to add it above the line that says /* That’s all, stop editing! Happy blogging. */.
Keep note that the debugging mode should not be enabled on a live website because it is designed specially and only for development purposes.
WP_DEBUG_LOG gives users the option to save all errors in a
debug.log file. The function is working perfectly with
WP_DEBUG while also helping reproduce issues for troubleshooting.
WP_DEBUG_LOG, you need to open your
wp-config.php file and then under
define( ‘WP_DEBUG,’ true ), enter the following:
After you have the function, the debug.log file would be saved automatically in the wp-content folder of your WordPress site. You will be able to view the file directly in your browser.
WP_DEBUG_DISPLAY is a function that needs to be disabled. That is to prevent error messages from being displayed on your WordPress website. By default, each time there is an error, it would be generated and displayed inside the HTML code of your site. Unlike
WP_DEBUG, the default value of
WP_DEBUG_DISPLAY is set to
true and needs to be changed to
false in order to hide all the errors.
WP_DEBUG_DISPLAY is not available, you have to add a line of code in the
wp-config.php file. Do that below the
define(‘WP_DEBUG,’ true). The code line to insert is:
All of the features we covered:
WP_DEBUG_DISPLAY could be used at once.
Understanding the proper use of
WP_DEBUG has lots of essential benefits for WordPress site owners and developers. However, if you have any questions, or if you are having trouble using the
WP_DEBUG mode, you can always open a support ticket and seek guidance from our 24/7 technical support team. They are ready to help you at any time. Also, if you are not yet a FastComet client, feel free to check our pricing list and decide if we are worth your attention.
We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!