InfoPhilic WordPress Debugging in WordPress: Easy guide

Debugging in WordPress: Easy guide

Troubleshooting PHP code is a piece of any undertaking. For this, WordPress incorporates a few settings that you can use to help investigate the principle application, topics, your own particular custom code, and that’s only the tip of the iceberg.

Some of the settings are specifically designed to use by developers and should not be used on “live” sites. Those settings include specific debug systems designed to simplify the process as well as standardize code across the core, plugins, and themes.

You can use them in certain scenarios to help troubleshoot errors you may be experiencing with third-party code, such as plugins or themes.

In this guide, I will tell you about various debugging tools and how you could efficiently perform WordPress debug task. I’m sure, it will increase the overall quality and interoperability of your code.

To do so, you initially need to enable debugging mode in WordPress:

  • Log in to cPanel, or access your account using SFTP.
  • Using the cPanel File Manager or the SFTP, open the wp-config.php file in your preferred text editor.
  • Add the following line to the wp-config.php file:
define('WP_DEBUG', true); // Enable WP_DEBUG mode
  • Save your changes and exit the text editor. If you choose SFTP then make sure you upload the updated wp-config.php file. Debugging mode is now active.

Enabling WP-DEBUG will cause all PHP errors, warnings and notices to be shown. This is probably going to alter the default conduct of PHP which just shows deadly mistakes as well as demonstrates a white screen of death when blunders are come to.

Such instance even leads to error messages for things that don’t seem broken but do not follow proper data validation conventions inside PHP.

Don’t get panic. They are easy to fix once you identified the relevant code and the resultant code will be bugless and easier to maintain.

Empowering WP_DEBUG will likewise cause notices about deprecated functions and arguments inside WordPress that are being utilized on your site. These are capacities or capacity contentions that have not been expelled from the center code yet but rather are slated for cancellation soon.

Though, there are also additional settings available in WordPress that will help you in your debugging task. Here is the list of them:


Let me explain them in detail,


WP_DEBUG_LOG is a partner to WP_DEBUG that makes all mistakes additionally be spared to a debug.log log record inside the/wp-content/. This is valuable on the off chance that you need to audit all notification later or need to see created off-screen.

Include the following line of code in your wp-config.php file:

define( 'WP_DEBUG_LOG', true ); // Enable Debug logging to the /wp-content/debug.log file

This will enable you to write to /wp-content/debug.log using PHP’s built-in error_log() function, which can be useful for instance when debugging AJAX events.


WP_DEBUG_DISPLAY is another option that controls whether troubleshoot messages are appeared inside the HTML pages or not. The default is ‘genuine’ which demonstrates blunders and notices as they are produced. Setting this to false will conceal all mistakes. This ought to be utilized as a part of conjunction with WP_DEBUG_LOG so mistakes can be surveyed later.

for this, you need to incorporate the following line of code to wp-config.php.

define( 'WP_DEBUG_DISPLAY', false ); // Disable display of errors and warnings


SCRIPT_DEBUG will force WordPress to use the “dev” versions of some core CSS and JavaScript files rather than the minified versions that are normally loaded. You should use it when you are testing modifications to any built-in .js or .css files.

Add this piece of code to the same file as above:

define( 'SCRIPT_DEBUG', true ); // Use dev versions of core JS and CSS files (only needed if you are modifying these core files)


The SAVEQUERIES is used as the definition that saves the database inquiries to a cluster and that exhibit can be shown to help examine those queries. The consistent characterized as true cases that make each query to be saved, to what extent that query executes, and what function called it.

define( 'SAVEQUERIES', true );

The array is stored in the global $wpdb->queries.

This could impact on your site performance. Thus, ensure to turn this off when you aren’t debugging.

Hence, you are done. Now, stop editing.

You might also like my other article for Setting Up WordPress Error Logs using WP-Config.

In case, if you faced some issues during DEBUGGING, feel free to ask your question in the comment section below.

Amit Malewar
Amit Malewar has been the tutorial writer since 2013. His passion for helping people in all aspects of technology flow through the expert coverage he provides. In addition to writing for InfoPhilic, Amit loves to read and try new things.

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.


Please enter your comment!
Please enter your name here



Get almost 100% PageSpeed on Newspaper theme

The newspaper theme is the most popular premium theme for a self-hosted WordPress blog. The theme is developed by team tagDiv. You can buy...

How to Remove jQuery Migrate in WordPress?

Learn how to remove jQuery Migrate from your WordPress site.

How to Delete Multiple Images in WordPress Media Gallery

Hey, guys, today, one of my friends asked me a question, How can I delete Multiple Images in WordPress? I replied, "It's very simple." Yeah,...

How To Reduce Admin-Ajax Server Load In WordPress

To increase better user experience, we always end up by increasing site speed. After clicking a website link seems like a simple thing. But...

How to create News Sitemap for WordPress site?

Learn how to create special news sitemap for your WordPress blog/ website using Yoast News SEO plugin and Jetpack plugin.



TRY SEMrush for Free!