How to Easily Enable WordPress Debug Mode to Fix Site Errors

Are you looking to enable the debug mode in your WordPress site?

You might encounter different errors when working with WordPress themes, plugins, or custom codes. Using WordPress debug mode, you can easily fix these issues.

In this article, we’ll show you how to easily enable WordPress debug mode to fix site errors.

How to easily enable WordPress debug mode to fix site error

Why Enable WordPress Debug Mode?

Sometimes a WordPress plugin, theme, or custom code like PHP or JavaScript can cause conflicts on your website. This can lead to different errors, and you may notice that your site isn’t functioning properly.

Now, you can always deactivate and uninstall multiple plugins to see which one is causing the error. Similarly, you can also switch to a different WordPress theme or remove the custom codes to find the root cause of the error.

However, all of this takes a lot of time. You’ll have to rule out each plugin individually, change multiple themes, and edit custom codes.

An easier way of fixing website errors is by enabling WordPress debug mode. It shows a log of all the errors and warnings on your website. This way, you can pinpoint issues on your WordPress site and fix them quickly. It even uncovers errors that might not be visible otherwise.

That said, let’s look at how to enable the WordPress debug mode. We’ll show you 2 methods. You can use a WordPress plugin or manually view the debug mode.

Method 1: Enable WordPress Debug Mode Using a Plugin

An easy way of enabling debug mode is by using the WP Debugging plugin. This method is recommended for beginners and those who aren’t comfortable working with website files.

WP Debugging is a free WordPress plugin that works out of the box. By using this plugin, you won’t have to edit your website files manually.

First, you’ll need to install and activate the WP Debugging plugin. For more details, please see our guide on how to install a WordPress plugin.

Upon activation, you can go to Tools » WP Debugging from your WordPress dashboard. Next, ensure that the ‘Set WP_DEBUG to true’ option is enabled.

View the wp debugging settings

After that, you’ll see a ‘Debug Quick Look’ option added to your admin bar at the top.

Go ahead, hover over it, and then click the ‘View File’ option.

Click view file in debug mode

This will open the log file with all the errors on your website. You can then find out what’s causing issues on your site and quickly fix them.

When you’re done debugging your website, don’t forget to disable the plugin.

Method 2: Manually Enable WordPress Debug Mode

The second method you can use to enable WordPress debug mode is editing the wp-config.php files. This method is more advanced and suitable for users who are comfortable editing website files.

We recommend creating a backup of your website before editing files. This way, you can easily restore your website in case anything goes wrong.

To access the website files, you’ll need a file transfer protocol (FTP) client for Mac or Windows.

For this tutorial, we’ll use the FileZilla FTP service. If you need help, then please can see our guide on what FTP is and how to use it.

Once you’re logged in, simply go to the public_html folder. Here, you’ll find the ‘wp-config.php’ file.

Edit wp-config file using FTP

Alternatively, many WordPress hosting services also let you manage your site files using the cPanel.

For instance, in Bluehost, you can visit the ‘Advanced’ tab and then go to File Manager.

Open file manager in Bluehost

From here, simply access the public_html folder from the panel on your left.

After that, scroll down to the ‘wp-config.php’ file.

Download the wp-config file

Next, you can right-click the file and download it on your computer. It’s smart to make a copy of the file as a backup, just in case anything goes wrong.

After that, open the file using any software or tool like Notepad or Sublime Text.

Once the file is open, scroll down to the ‘That's all, stop editing! Happy publishing‘ line and add the following code before that:

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

Don’t forget to save the file before closing it.

Save the wp-config file

Next, you’ll need to upload the wp-config.php file back to your website server using the FTP client.

For more details, please see our guide on how to use FTP to upload files to WordPress.

To view the error logs for your website, you’ll need to view your website files and navigate to the public_html/wp-content/debug.log path. Simply download the file and view it in a notepad software to see issues on your site.

View the debug log file

Once you’re done debugging your site, you can disable the debug mode.

To do that, repeat these steps and then remove the code you added to the wp-config.php file or edit the following code to have a false value:

define( 'WP_DEBUG', false);

We hope this article helped you learn how to easily enable WordPress debug mode to fix site errors. You can also see our ultimate WordPress SEO guide for beginners and our expert tips on how to improve WordPress security.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Easily Enable WordPress Debug Mode to Fix Site Errors first appeared on WPBeginner.

How to Find and Access WordPress Error Logs (Step by Step)

Do you need to access the WordPress error logs to troubleshoot a problem on your site?

WordPress comes with a debugging system that can log any error messages displayed on your site. This can help you discover and fix problems on your website.

In this article, we’ll show you how to find and access your WordPress error logs.

How to Find and Access WordPress Error Logs

How and When Can WordPress Error Logs Help?

Are you having problems with your WordPress website? Checking your WordPress error logs can help you find the source of problems such as slow website performance, plugins that aren’t working properly, and website crashes.

What is an Error Log?

An error log is a list of error messages generated by your website and the dates and times they occurred. Once WordPress debug mode is turned on, these messages are collected in a file, so that you can review them later.

Your WordPress error log is a troubleshooting tool that can help you identify the plugins, themes, or code that are causing problems. You can then go ahead and find a fix for those WordPress errors.

For example, checking the error logs can help troubleshoot errors like the WordPress white screen of death, PHP errors, the invalid JSON error, and the “Sorry, you are not allowed to access this page” error.

That being said, let’s have a look at how to find and access your WordPress error logs. The first step is to enable WordPress debug mode, which you can do using either a plugin or code.

Enabling WordPress Debug Mode With a Plugin

WordPress debugging is turned off by default, so WordPress will not be logging any errors. If you can still log into your WordPress site, then you can enable debug mode using a plugin.

The first thing you need to do is install the WP Debugging plugin. For more details, see our step by step guide on how to install a WordPress plugin.

WP Debugging plugin

Upon activation, the plugin automatically activates WordPress debug mode, and error messages on your site will now be logged.

Enabling WordPress Debug Mode Using Code

You can also turn on WordPress debug mode using code. This is suitable for more advanced users, or if you can’t log in to your WordPress admin area.

You will need to edit your wp-config.php file using an FTP client or the file manager option in your WordPress hosting control panel.

Edit Your Website's wp-config.php File

Once you have the file open, you need to find the text where it says ‘That’s all, stop editing! Happy blogging.’

Just before this line, go ahead and add the following code:

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

For step by step instructions, see our guide on how to set up WordPress error logs in wp-config with code.

How to Find and Access WordPress Error Logs

Now that you have enabled WordPress debug mode, any future error messages on your website will be stored in the WordPress error logs.

That means that your logs will be empty at first. You will need to try to recreate the problem on your site, so the error messages can be saved to the log file. For example, you should revisit any posts or pages that are causing an error.

Next, you need to connect to your website using an FTP client or the file manager option in your WordPress hosting control panel. If you haven’t used FTP before, then you may want to see our guide on how to use FTP to upload files to WordPress.

Once connected, you should navigate to the /wp-content/ folder. Inside the folder, you will find a file called debug.log. This file contains every WordPress error message, warning, and notice that has been logged.

Download, View, or Edit the debug.log File

To see the contents of this file you will need to download, view, or edit it. You can then inspect the error messages along with the date and time they occurred. This information can help you find a solution to the problems you are encountering on your website.

Debug.log Contains Error Messages and Time Stamps

How to Fix Issues Found in WordPress Error Logs

Once you’ve accessed your WordPress error logs, you can find the error message that was logged at the time the problem on your website occurred. Keep in mind that the times displayed are UTC, not your own local time.

While most users won’t understand what the error messages mean, they’re a good place to start troubleshooting. Once you note the error message and code, you may find a solution to your problem in our guide on the 50 most common WordPress errors and how to fix them.

If you can’t find the solution on your own, then you can reach out for help on our free WPBeginner Engage Facebook Group where you can get help from our WordPress experts and over 80,000 users. Make sure you quote the error code or message you found in the WordPress error logs.

Other places you can turn for help are the official WordPress forums, your WordPress web hosting company’s support team, or the designated support area for the plugin or theme you are having trouble with.

When asking for support, check our guide on how to properly ask for WordPress support and get it to learn the right way to ask questions and the best places to find support.

Disabling WordPress Debug Mode

Once you have fixed the issue on your WordPress site, we recommend you disable debug mode.  Leaving it on may slow down your website and can potentially leak unwanted information which is a security risk.

If you enabled debug mode with a plugin, then simply navigate to Plugins » Installed Plugins and deactivate the WP Debugging plugin.

Deactivate the WP Debugging Plugin

If you enabled debug mode with code, then simply edit the wp-config file as you did before.

You need to change the WP_DEBUG and WP_DEBUG_LOG lines to ‘false’.

Deactivate WordPress Debug Mode

We hope this tutorial helped you learn how to find and access your WordPress error logs. You may also want to learn how to get a free SSL certificate for your website, or check out our tips on how to speed up WordPress performance.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Find and Access WordPress Error Logs (Step by Step) first appeared on WPBeginner.