How to Enable WordPress Error Logs Using wp-config.php

If you're a regular WordPress user, you may have heard about wp-config.php and how vital it is for your website. It not only controls the database connection but also helps you find bugs and fix them.

The file consists of a few WordPress settings, which are responsible for making a connection between the site's data and its database.

But if you want to troubleshoot your site, you require a few difficult steps. Enable WordPress error logs in wp-config.php, which helps you find out the resources generating errors.

You may be wondering if there is something a non-techie person can't do without coding. Well, you can accomplish such a task by defining two things.

In this tutorial, you're going to enable WordPress error logs using wp-config.php. I am sure, you have edited the file before.

You can either use an FTP account or directly access cPanel. I prefer cPanel because many web hosting companies don't offer FTP access due to security reasons.

Use cPanel to Edit wp-config.php

As always, you may be wondering if cPanel looks the same for everyone. Well, every company has its brand value, brand color, and they try their best to maintain those.

So, the design layout may be different, but the overall concept of cPanel remains the same because it's a software.

Let me walk through the step by step process.

Step 1:

As usual, you need to log into the cPanel account your web hosting has provided. Search for the Files' section, which consists of the file manager icon.

How to Enable WordPress Error Logs Using wp-config

If you use Bluehost, Siteground, Inmotionhosting, Hostinger, and any of thebest hosting services, you can easily find the file manager.

Step 2:

A few companies allow you to choose the directory you want to open by showing a popup before opening the file manager.

But if you directly see the files and folders, it's possible that you're in the home directory. But the content is available in the public_html or root directory.

How to Enable WordPress Error Logs Using wp-config

Click on public_html from the left-hand sidebar.

Step 3:

If you host one website on the server, you can find the wp-config.php file in the root directory. But if you host multiple websites, you need to open the domain's folder where WordPress installation is residing.

How to Enable WordPress Error Logs Using wp-config

Right-click on the file and choose an Edit option. As always, you can also use the standard Edit option from the main navigation menu of cPanel.

Step 4:

A popup appears for encoding confirmation. Click on the Edit button to continue.

How to Enable WordPress Error Logs Using wp-config

Step 5:

A new tab opens up in the web browser, where you can see codes of the file. You need to copy and paste the code shown below.

define( 'WP_DEBUG', true );

It's possible that you see the similar code in the file, in which the parameter is false instead of true. The above-shown line enables WordPress to debug mode.

But the problem is you don't need to see code syntax in your wp-admin area. Now, you need to add another line of code to log in errors.

define( 'WP_DEBUG_LOG', true );

Click on the Save Changes button.

Now if you wish to check the login error, go to the wp-content folder, and you can see a new file "debug.log", you can download the file and speed up your troubleshooting process.

How to Enable WordPress Error Logs Using wp-config

Wasn't that Easy to Enable WordPress Error Logs

Now and then people start getting so many errors. And you know that most of the WordPress users are non-techie, and they might fret a lot.

But if you go through each step, you may realize that even a newbie can pull this off. Enabling WordPress error logs using wp-config.php is easy.


You have edited the file a couple of times, but I am sure you haven't noticed the debug code. Well, now you know what it is and how you can enable it.

Dealing with a WordPress error can be overwhelming if you don't understand it. And I hope you have understood the concept of enabling error logs.

Check out these top 3 WordPress hosting services:

Was this article helpful?