Ultimate Guide To Enable Or Disable WordPress Debug Mode: Debugging & Removing Error Lines

The ultimate guide to enabling or disabling WordPress debug mode, let's dive into WordPress built-in debug mode and show you how to enable it

Updated on July 25, 2022
Ultimate Guide To Enable Or Disable WordPress Debug Mode: Debugging & Removing Error Lines

This is the ultimate guide to enabling or disabling WordPress debug mode, debugging and removing error Lines; In a perfect world, you won’t have any problems that need to be debugged. But in the real world, you will almost certainly encounter issues with your WordPress site that require a behind-the-scenes look.

Ultimate Guide To Enable Or Disable WordPress Debug Mode: Debugging & Removing Error Lines

Ultimate Guide To Enable Or Disable WordPress Debug Mode: Debugging & Removing Error Lines

To help you with this, WordPress has its built-in debug mode. There are also use third-party tools to help you debug WordPress.

This post will provide the ultimate guide to enabling or disabling WordPress debug mode. First, we’ll delve into WordPress’s built-in debug mode and show you how to allow it. Next, we’ll share other ways you can debug your WordPress site.

What is debugging?

You’ve encountered issues with your website using different themes and plugins. Sometimes this can take you hours to find the source of the problem. So, this is where debugging can help. You can enable debugging in several ways, and this document will show you how.

Installing new plugins or themes and updating or adding custom code can cause conflicts. So, some issues, such as a white screen of death, may make your website unusable. Others only appear in certain situations and cause problems with particular features or plugins. 

These can usually be fixed by manually disabling all plugins and can solve the problem individually. So this way, you can find out which plugin is causing the pain. You can also switch to another theme to check if the problem is coming from this side. Unfortunately, all of this takes a lot of time.

If you enable debug mode, it will display a PHP error and warning log. So, this can help you find the source of the problem quickly.

You can use this to avoid some problems. For example, some errors seem only visible, not to log in debugging, even if everything goes well on your site.

And you can enable debug mode using a plugin or manually. We’ll show you how to do this using both methods.

And also, no matter which method you choose. It is not recommended to do this on your desktop (same as your new installs, tweaks, etc.) So by doing this, you can check your test environment, find errors and fix any problems without your errors.

Method 1 – Enable debugging from WordPress debug mode using a plugin

And so, if you are not sure what to do with your site files or find method 2 too complicated, then the WP Debugging plugin is the right solution. You can enable debugging with a plugin by following these steps:

  1. Navigate to Dashboard > Plugins > Add New;
  2. In the search bar, type wp debugging;
Ultimate Guide To Enable Or Disable WordPress Debug Mode Debugging & Removing Error Lines
  1. Click the Install button on the WP debug map from the results. Once you install the plugin, you will see an Activate button in the exact location.
  2. Click on the “Activate” button;
  3. Navigate to Dashboard > Tools > WP Debugging;
  4. Select the check box next to the Set WP_DEBUG to true option and click the Save Changes button.
Ultimate Guide To Enable Or Disable WordPress Debug Mode Debugging & Removing Error Lines

Enable WordPress debug mode using a plugin

Don’t forget to disable debug mode after you’re done.

Method 2 – Enable debugging using manually.

And so, if you prefer to do it manually and have no problems editing the site file, or if you are stuck on the site (e.g., White Screen of Death) and have no other option, how can this be done by editing your wp-config.php file.

How to access the wp-config.php file?

Before making any settings on your files, create a complete backup of your website. Also, it is recommended that you make a copy of the original file before editing it. Something gives this initial error; you can always use that original file to start over.

We’ll use the FTPZ File client for this article, so install it on your computer (unless you’re familiar with another FTP client you’d prefer). Let’s start:

  1. Your FTP Access Data to FileZilla’s Site Manager
  2. Connect to your server.
  3. Navigate to your website’s public_html (root) folder. So, here you should find the wp-config.php file found.
  4. Right-click the file and select “Download” to copy the file to your computer.
  5. Open the file in the code editor and edit the file. You can edit the file using a code editor such as Sublime Text or Notepad ++.
  6. Scroll down to the “That’s all, stop editing! Happy publishing” line

the following value before that line and save the changes:

  • define( ‘WP_DEBUG’, true);
  • define( ‘WP_DEBUG_LOG’, true);

Step 8: After modifying the file, upload the file back to your server (using an FTP client) and replace the original file with the modified file.

Following these steps, you will enable debug mode and create a debug.log file to save your errors.

To disable debug mode when done, repeat as enabling steps, just this once, completely removing code previously added or modified as follows:

  • define( ‘WP_DEBUG’, false);

How to use debug?

If you’re trying something that can’t happen, repeat the problem that led to this issue once debug mode is enabled. This will create a new error log, and you can check it.

Method 1 – Using a plugin

Click the Debug Quick Look menu in the admin bar at the top of the dashboard screen. Then, from the drop-down menu, click the View File option. This will open a new tab with errors in the debug log.

Ultimate Guide To Enable Or Disable WordPress Debug Mode Debugging & Removing Error Lines

Method 2 – Access the site file and go to the next path

public_html / wp-content / debug.log-Open the file and display the error in the debug log.

Summary

We saw with this ultimate guide to enable or disable WordPress debug mode. If you need to debug WordPress, WordPress’s built-in debug mode provides a convenient way to view PHP errors and warnings.  

You can enable it directly from your dashboard. If not, you can enable it by using a plugin or adding a code snippet to your site’s wp-config.php file. 

If you need more help, you can use other built-in or third-party tools such as New Relic (which requires your license) or the free Query Monitor plugin.