Although WordPress is relatively easy to manage, troubleshooting errors is quite a common problem for its users. Dealing with them is usually not difficult – it just takes a little practice. The first step in every WordPress error troubleshooting is to retrieve the error log.

The error log contains all errors, warnings, and notices about your site’s code. This can sometimes help you identify the exact file and line of code causing the problem. The error log can also provide clues for resolving seemingly unsolvable errors, such as the “white screen of death.”

However, making sense of the error log can be quite difficult if you’re not tech-savvy. To become tech-savvy, you have to start somewhere – so let’s start by showing you how to enable and acquire the error log in WordPress.

How to Configure WordPress Error Logs in Your WP-Config File

The wp-config.php file is an important WordPress configuration file. Modifying it slightly will enable default WordPress debugging and show errors. You can do this through an FTP client or through cPanel.

Using an FTP client

A prerequisite for making changes to your server files is to set file permissions correctly. Suggested permissions on the wp-config.php file are 440 or 400. This means you are only allowed to read files. To be able to acquire an error log, you need to temporarily change the file permissions to 644 or 666. For clarification, 644 gives read and write/edit permissions to admin users, while the rest of users don’t. gets only read permissions. The value 666 grants both types of permissions mentioned above to all users.

To continue you need an FTP client and knowledge of editing the wp-config.php file. Start by connecting to the server using your FTP credentials. Access your WordPress root directory. Locate it wp-config.php file, right click on it and select the “File Permissions” option.

File permissions

Manually insert one of the suggested numeric values ​​(644 or 666) and click ” Okay”.

Manually insert one of the suggested numeric values

After changing the permissions, return to the root directory, right click on the wp-config.php file and select ” View edit”.

Modify the WP configuration

Open the file using a text editor and insert this line of code:

define(‘WP_DEBUG’, true);

above the /* That’s it, stop editing! Good blog. */.


If the define(‘WP_DEBUG’, false); the line is already present, only change false to true.

Save the changes and upload the modified file to your root WordPress directory. This will overwrite the file that is currently on your server.

Through cPanel

You can also use cPanel to edit the wp-config.php file. Login to cPanel using your credentials and click on the ” File manager”.

File manager

Navigate to the root directory of your WordPress installation on the left, locate the wp-config.php file, right-click on it and select ” Change permissions”.

Wp-config permissions in cPanel

Make sure you enable read and write permissions for the user (admin) by checking the appropriate box. Then click on ” Change permissions”.

Wp-config Permissions in cPanel Edit Permissions

Then right click on the wp-config.php file again and select ” Edit”.

cPanel edit wp-config

The file will open in the default cPanel editor, so you just need to add the define(‘WP_DEBUG’, true); above /* That’s all, stop editing! Happy blogging. */ line of code in wp-config.

If the file already contains the following line define(‘WP_DEBUG’, false); just change the fake to real and click “Save Changes” in the top right corner of your screen.

Change fake to real

How to manage the display of errors

Once you have successfully displayed the errors, they will display on your pages, both on the backend and the frontend. Unless your site is under development, exposing errors live is clearly not a good idea. Instead, you should save them to a single file and hide them from your site. This will allow you to view the file later and resolve errors at any time.

To do this, add this code to your wp-config.php file.

define( ‘WP_DEBUG_LOG’, true ); define( ‘WP_DEBUG_DISPLAY’, false ); @ini_set(‘display_errors’, 0);

Add the code below the following line define(‘WP_DEBUG’, true); and above the /* That’s all, stop editing! Happy blogging. */ line of code.

You can edit the file using an FTP client or through cPanel, following the same steps described in the previous section. After the modification, your wp-config.php file should look like this.

Manage error visibility

By adding define( ‘WP_DEBUG_LOG’, true ); we force WordPress to store all error messages in a single file. By default, this file is called debug.log and is located in your WordPress root directory/wp-content/. You can also store error messages in another file that you have created. In this case, replace true with “define( ‘WP_DEBUG_LOG’, true ); to the file path. For example:

define( ‘WP_DEBUG_LOG’, path-to-your-site/wp-content/error.log );

Furthermore, WP_DEBUG_DISPLAY determines whether error messages are shown or hidden on screen. By adding define( ‘WP_DEBUG_DISPLAY’, false ); you tell WordPress to hide the posts from your screen, but they are still printed to the designated file. If you too add @ini_set(‘display_errors’, 0); this will disable error printing for your PHP, making sure users can’t see them on the frontend.

Error log acquisition

With the errors displayed and successfully written to the appropriate error log file, all that remains is to examine the error messages and take further action.

Downloading the debug.log file manually

To download the log file connect to your server, access your WordPress root folder and click on wp content. Find it debug log file inside, right click on it and press ” To download”.

Downloading the debug.log file manually

Save the file to your desktop. Then make sure to undo the previous changes. This includes removing the code you inserted and changing the permissions on the wp-config.php file to 440 or 400. If desired, you can do this after resolving the errors.

Finally, open the saved debug.log file with a text editor and check the error messages written. Depending on your level of expertise, you can either fix the errors yourself or hire a developer.

More advanced debugging features

We’ll also look at some more advanced debugging capabilities. The following code should be added in wp-config.php, above the /* That’s all, stop editing! Happy blogging. */ line.

1.define( ‘SCRIPT_DEBUG’, true );

This code forces WordPress to use non-minified versions of CSS and JS files, which is useful for debugging changes and/or errors found specifically in your CSS and JS files.


2.define( ‘CONCATENATE_SCRIPTS’, false );

By setting the CONCATENATE_SCRIPTS constant to false, you force WordPress to load all scripts separately. This can be useful in identifying faulty/incompatible scripts.


2.define( ‘SAVEQUERIES’, true );

If you are having database problems, analyzing the queries executed is a good way to start debugging. By inserting the code above, you put the content of the query, which function called it and for how long it was executed in the array $wpdb->queries. This will allow you to dive deeper into the backend part of the theme’s code and what exactly it does.

More advanced debugging features

You can then add the following code to display all queries in readable form and analyze them.

global $wpdb; print(”



However, keep in mind that this code will affect your site’s performance, so we recommend using it for debugging purposes only.

Final Thoughts

By following this guide, you can safely view and store error logs in a file, change file permissions, and run some debugging features for more advanced WordPress users. This tutorial will also help you learn more about how your website works. So keep it handy, as you may need these instructions in the future.