How to Enable WordPress Debug Mode: 2 Methods

Are you looking for ways to troubleshoot conflicts on your site? Finding the cause of the issues can save you a lot of time, so if that’s something that interests you this post is for you. In this guide, we’ll show you 2 ways to enable the WordPress debug mode and find conflicts on your website.

Regardless of how careful you are, if you have a website you will always face various issues. Troubleshooting these errors isn’t always easy and it may take you hours to find the root of the conflicts. That’s why knowing how to troubleshoot these problems and solve them is key to avoiding headaches. In this article, you will learn how to enable the debugging mode in WordPress and fix your issues in no time.

Before we go into that, let’s better understand what the debug mode is.

What’s the Debug Mode?

The Debug mode is a technique that developers use to identify potential threats and warnings caused by PHP or other programming languages. As you probably know, WordPress is built with PHP, JavaScript, HTML, and CSS, so you may face some errors caused by errors in the code. For example, your site may get compromised when you:

  • Update the PHP version
  • Add custom code
  • Install a new theme/plugin
  • Update your theme/plugins
  • Update WordPress

Usually, your plugins cause conflicts because of an update or incompatibility. Issues vary a lot and range from a harmless conflict to creating problems on the checkout page or the white screen of death if you’re unlucky. By default, WordPress doesn’t come with an inbuilt function to monitor these conflicts, so it can be challenging to know what’s going on. The good news is that you can do a few things to be able to see the errors and fix them before it’s too late. This allows you to troubleshoot more accurately and solve the issues much faster.

When you enable the debug mode, WordPress will display every error on the admin area right below the top navigation bar. This way, you can quickly keep an eye on the warnings and fix whatever is needed. Even though not every error needs urgent attention, fixing them as soon as they appear will help you make sure that things don’t worse and you offer a great user experience.

Now let’s see different ways to activate the debugging mode.

How to Enable the WordPress Debug Mode

You can enable the WordPress debug mode in two ways:

  1. Manually
  2. Using a plugin

In this section, we will show you both methods so you can choose the best one depending on your needs.

1) Activate debug mode manually

If you have coding skills and are comfortable editing core files, this method is for you. To enable the debug mode, you will need to add a code snippet to your wp-config.php file. You can either use an FTP client like FileZilla or a dedicated file manager plugin. For this demonstration, we will use the File Manager plugin.

NOTE: The changes we will make are quite simple but it’s always recommended to create a backup of your site before starting.

1.1) Install and Activate File Manager

The first thing you need to do is install and activate the File Manager plugin on your WordPress installation. Go to Plugins > Add New, search for the plugin and install it.

redirect a wordpress page - install wp file manager

1.2) Plugin Configuration

After activation, open the plugin’s settings under WP File Manager. There, you will see all the directories and files hosted on your server.

file manager

Before modifying the wp-config.php file, we recommend you download a copy of it to your local computer. This way, if anything goes wrong, you can easily remove the modified version and upload the parent file. This way, you can add an extra precaution.

download wp config file

Once you have downloaded the file, in File Manager right click on the wp-config.php file and use the Code Editor option to modify it.

enable wordpress debug mode - file manager code editor

1.3) The snippet

Once you open it, you will see the editor. From there, you can add or remove the file’s code.

enable wordpress debug mode - edit wp config

If you scroll to the bottom, you will see a line that says /* That’s all, stop editing! Happy publishing. */. Copy the following code and paste it right before that line.

define( 'WP_DEBUG', true );

The code simply tells WordPress to enable the debug mode.

save wp config file

If your wp-config.php file already has this snippet, but the constant is set to false, you don’t need to add the code again. All you need to do is change the word false for true.

That’s not all. The problem with this snippet is that it will display all your website’s conflicts (if you have any) on the front and backend. This means that if your site is live, visitors will be able to see the alerts and it may confuse them. Isn’t there a way to hide them? Yes, there is! Additionally, keeping a log of all the issues can be handy.

1.4) Snippet to hide alerts from the front end

To hide the alerts and keep the log, use the below snippet and paste it below the debug code you’ve just added.

// Save debug.log to /wp-content/debug.log
define( 'WP_DEBUG_LOG', true );

// Hide errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

create debug.log

Once you’re done, remember to save the settings and that’s it! You have now enabled the debug mode in WordPress manually. From now on, you will be able to keep an eye on the alerts but your website visitors won’t see them on the front end.

If you don’t feel comfortable with this method, there’s another alternative for you.

2) Enable the debug mode with a plugin

If you don’t want to edit core files, you can activate the debug mode with a plugin. In this section, we’ll show you how to do that step-by-step.

WP Debugging is a dedicated plugin to enable the debugging mode on any WordPress installation. In this section, you will learn how to do it step by step.

2.1) Installation and Activation of WP Debugging

First of all, you need to install and activate the WP Debugging plugin on your website. This plugin is in the repository so, in your admin dashboard, head to Plugins > Add New, look for the plugin, and install it.

enable wordpress debug mode - install WP Debugging plugin

2.2) Plugin Configuration

Once you have installed and activated the plugin, you will see the configuration under the Tools section.

enable wordpress debug mode - wp debugging settings

The plugin will automatically add this code to your wp-config.php file:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );

This code activated the debug mode. Simply tick the option to “Set WP-DEBUG to true” and save the changes.

This will also display the errors on the front end, so we recommend you also select the option “Set WP_DEBUG_DISPLAY to false, default is true” to hide the alerts.

After that, visit some website pages where you have problems or conflicts to make sure that the messages aren’t there. Finally, you can also check the debug.log file for error messages.

And that’s how you can enable the debug mode in WordPress with a plugin. Keep in mind that if you uninstall WP Debugging, the code it added will be removed.

Activating the debugging mode is the first step. Now you need to know how to check the error messages so you can fix them as fast as possible. Let’s see how to do that.

How to Check Error Messages

After enabling the debug mode, WordPress will store a log of every issue in your server. You can find the log in your file manager using an FTP client or with a dedicated plugin. In this section, you will learn how to check error messages correctly.

For this demonstration, we’ll use the File Manager plugin but you’ll be able to follow the explanation regardless of the method you choose.

First, open the wp-content folder. There, you will see a new file called debug.log that contains the log of all the errors.

wp content debug log

Open the file, and you will see all the errors you need to fix with their date and time.

error log

NOTE: Enabling debug mode and troubleshooting on a live website is not a recommended practice. Instead, you can create a staging environment and do all the necessary tests there. Once you have the solution, you can apply it to your live site. Most WordPress hosting companies offer free staging environments for testing and development purposes, so this shouldn’t be hard.

Conclusion

All in all, by default, WordPress doesn’t have an inbuilt function to monitor bugs and conflicts. This makes it challenging to know what the problem is and hence solve it.

The debugging mode allows you to find bugs and errors and fix them quickly. In this guide, we’ve seen two different ways to enable the debug mode in WordPress:

  • Manually with a bit of code
  • With a plugin

If you’re comfortable editing core files, you can activate the debug mode manually with a few lines of code. This method is straightforward and it doesn’t affect your website’s speed and performance. On the other hand, you can use a plugin to activate debug mode without having to edit any core files. This method is perfect for beginners as it lets you have the debugging mode up and running in a few clicks. Both methods are effective, so choose the one that best suits your requirements and preferences.

Finally, if you want to learn to fix some of the most common WordPress issues, have a look at the following guides:

Have you enabled the debug mode on your site? Which method did you use? Let us know in the comments below!