Enable Debug Mode In WordPress

If you are a WordPress developer developing the WordPress themes or plugins, for yourself, or for any company which you are associated with, then, you may need to be familiar with the WP_DEBUG script, which is of WordPress for debugging it. It is the global variable for which WordPress will be displaying the errors if any while you visit your site. So, it is mostly likely to be usable when you are developing the WordPress theme or plugins for your site or any, to debug the created code. Also, since PHP will not show all of the errors came during the development phase, especially for WordPress itself. So, it will be best practice to enable debug mode while developing the themes and plugins. Here, below is the code to enable the debugging script in WordPress:

define( 'WP_DEBUG', true ); // Enabling the WordPress Debug Mode.
if ( WP_DEBUG ) {
define( 'WP_DEBUG_LOG', true ); // Adding the 'debug.log' file inside 'wp-content' folder.
define( 'WP_DEBUG_DISPLAY', true ); // Displaying the debug messages inside the pages.
@ini_set( 'display_errors', 1 ); // Displaying the error messages.
define( 'SCRIPT_DEBUG',true ); // Enabling the debug mode for CSS and JS.

So, after we have provided the above code to display the error of WordPress via the WP_DEBUG mode, so, you now might be on confusion about where this code need to be inserted. So, to make your confusion clear on this, the above code needs to be inserted in the wp-config.php of your WordPress install, just above the code shown below:

/* That's all, stop editing! Happy blogging. */

Remember: If you plan to deploy the developed WordPress themes or plugins and submit it to the WordPress themes and plugin directory respectively, then, this option, WordPress debug mode need to be enabled while developing, because if there are any errors on your developed files, then, your themes or plugins might not be accepted at all and make them live, until these error has been solved from those files. Hence, in the case, if you may require the screenshot for it, about how to add that provided code in the mentioned file, then, it is shown below:


Post navigation

Bishal Napit

Bishal Napit is a WordPress theme developer from Tansen, Palpa, with a passion to learn more on WordPress.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.