Debug WordPress: A Comprehensive Guide for Beginners

Debug WordPress: A Comprehensive Guide for Beginners

While creating and maintaining a WordPress website or plugin, you may encounter some errors that prevent it from functioning. This is why knowing how to debug WordPress is important. Debugging means identifying and removing the bugs or errors in your code.

This article is going to explore seven tips on how to debug WordPress – from activating the debug mode to installing debugging plugins. This way, you can quickly spot the code problems in your site to make it run smoother.

Debugging WordPress – Video Tutorial

Don’t want to read? Learn how to check your WordPress error log to identify issues on your site in our video tutorial.

Subscribe For more educational videos! Hostinger Academy

What Does Debugging Mean?

Debugging, or simply debug, means to identify and remove bugs or errors in your code. The final step of debugging is to test the code correction and make sure that the problem doesn’t happen again.

This is mainly performed by web developers using debugging tools, and it’s a part of a routine in the software development stage.

The debugging process can be done using strategies such as unit test, code review, and pair programming.

So before the code or software is published to the users, developers will try to find any issues, then isolate and fix it.

Sometimes, fixing the code can be a real headache, as it might take longer than writing the code itself.

7 Tips for Debugging Problems in WordPress

When your WordPress site crashes or has the white screen of death (WSoD), the common response is to deactivate plugins/themes and check for their updates.

While that is helpful for narrowing down the culprit, it can be time-consuming, inefficient, and you could also let the real issue slide unnoticed. That’s why having the right tools can be a real game-changer.

1. Activate WP_DEBUG

Activating WP-DEBUG is probably the most simple way to help troubleshoot problems such as critical error on WordPress.

To enable it, follow these steps:

1. Access the wp-config.php file within the public_html folder.
2. Look for this line of code:

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

3. Add the following line of code above it:

define(‘WP_DEBUG’, true);

2. Enable WPDP Error Reporting

To detect any database connection errors, you can enable WPDP error reporting.

The global $wpdb object has a variable called $show_errors. And if you set this to true, you can make WordPress output the SQL errors to the screen for any given query.

The class-wpdb.php file for WordPress. Database error logging is set as true

To enable this, go to your /public_html/wp-includes/class-wpdb.php and open the file. Search for the wpdb class and change the $show_errors variable to true.

3. Check Your Website’s Error Logs

Sometimes, you can encounter the interval server errors page when browsing your site. And to fix such an issue, you can review your website error logs.

Doing a general log check-up can help both beginners and advanced developers to detect the website’s problem.

You can then use Google search to look for a possible fix. We’ve covered more detailed steps to check website error log in this tutorial.

4. Use WordPress Staging Environment when Tweaking Your Code

If you want to minimize bugs on your WordPress site, you can do so by implementing the code first on a staging site.

A staging site is almost an exact clone of your live website and can be hosted on your private subdomain. This site acts as a development ground for whatever codes you want to push for your live site.

This environment is mostly not visible to visitors and search engines. So you can have more freedom to tweak, tune, and test the changes you want to bring, without affecting your public, live site.


By default, WordPress uses the minified version of CSS and JavaScript files to help improve your site’s load time. However, this can be a problem because it may hide errors in the scripts/plugins that you use.

To change the script execution, WordPress also provides a constant that we can add to the wp-config.php file, that is:

define( 'SCRIPT_DEBUG', true );
Enable SCRIPT_DEBUG in the wp-config.php

When the value defined as true, WordPress will automatically load the non-minified versions of all CSS and JavaScript files, making all plugins use their full version.

6. Detect PHP Errors

You can detect the PHP errors early in your scripts using phpinfo. This file can output information about the current state of PHP, including the compilation options and extensions, PHP version, PHP file size limits, maximum execution time, environment, OS version, HTTP headers, and license.

To do so, you can configure the php.ini file to enable error reporting. However, some hosting services, including Hostinger’s shared hosting plan, disable this option.

That’s because you don’t have the root access to enable the feature.

But, you can use PHP code checker to help with syntax errors instead, which provides you with a straightforward assistant to review botches in your code. And for a more thorough review, you can also use IDEs like Eclipse or PHPStorm.

7. Take Advantage of Some Debugging Tools

If you need simplicity to monitoring bug on your WordPress site, you can also take advantage of WordPress debugging plugins.

1. Query Monitor

Query monitor to debug WordPress

This plugin provides a developer tool panel on WordPress. You can enable database queries, PHP errors, HTTP API calls, hooks & actions, stop editor blocks, enqueued scripts & stylesheets, and more.

Alternatively, you can also use Debug Bar and Simply Show Hooks to help you debug WordPress site. However, these two plugins may have compatibility issues with the most recent version of WordPress.

2. New Relic

New relic monitoring apps to debug WordPress

You can also perform a more robust debug using a premium tool such as New Relic. This app will help you to monitor the user experience, map your WordPress architecture, find broken permalinks, analyze and improve the site’s performance, and detect anomalies before they happen.

All of those features will help you to gather data for troubleshooting so you can provide the best possible visitors’ experience. You can trial New Relic for 14-day free.


That’s all the tips you need to know about debugging WordPress site. As a developer, you need to identify and fix the problems before pushing whatever code/plugins to users. As a webmaster, you can also use debugging tools to identify what causes performance issues on your website.

To debug your WordPress site, you can do the following:

  • Activate WP_DEBUG
  • Enable WPDP Error Reporting
  • Check Your Website’s Error Logs
  • Use WordPress Staging Environment when Tweaking Your Code
  • Detect PHP Errors
  • Use Debugging Tools such as Query Monitor or New Relic

Good luck for debugging your WordPress site, we hope that you can mitigate problems to ensure a seamless visitor’s experience.

WordPress hosting banner

Debug WordPress FAQ

What Is WordPress Debug Mode?

The WordPress debug tool makes it easy to see what causes errors on your website. Most developers recommend creating and using a debug log file to keep track of issues on your website, rather than tracking your live website only.

How Do I Check My WordPress Debug Mode?

Connect to your WordPress server. Head to the /wp-content/ folder and locate the debug.log file. It contains all errors, notices and warnings that WordPress has logged, and you can download, view and edit this file yourself.

The author

Luqmanul M.

Luqman is a self-proclaimed social scientist. He is passionate about education, technology, and everything in between. He wants to help create a high-quality education system. Having spent the past four years as a social researcher and blog guru, he lends his skills to Hostinger's digital content team. As for free time, he enjoys reading scientific (and not-so-scientific) literature with a cup of black arabica coffee as a companion.