It can be difficult to diagnose WordPress errors, especially if you don’t have much technical knowledge. From permissions issues to files not found situations to PHP errors, there are many types of WordPress errors that can cause problems with your blog.
The most frustrating errors are the ones you have to figure out and debug yourself. It’s important that you monitor all the errors that happen on your site. Otherwise, your data transfer capacity could be disrupted. Glitches could happen that drive visitors away. Your site might even stop working completely.
Before you can fix a problem, you need to know what’s causing it. Not all errors are visible, though. You must look at your error_log.php file, which shows you the specific errors generated across the system and the files that tripped the errors, to see everything that’s wrong with your site.
The only problem is that checking for errors in the error_log.php file is inconvenient. Instead, you should set up WordPress error logs in your wp-config file.
As an admin, you probably don’t want to display errors to your visitors. That might scare them off.
Also, there may be errors that you are not aware of as you never triggered them, but your site’s visitors, unfortunately, are encountering them constantly and reporting them to you.
The best way to review all your errors without displaying them to your visitors is to use the wp-config file.
What’s The WP-Config File?
The wp-config.php file is a core WordPress file that contains information about your blog’s settings.
These settings will be used by your site to determine how to associate with the WordPress database, how to set up the table prefix of the database, and how to generate the various authentication keys you need to make your site more secure.
In addition to those functionalities, the wp-config.php file can also be used as a debugging tool to find and fix errors. You can use it to save error logs as well.
Setting Up WordPress Error Logs In WP-Config File
Your wp-config.php file is located in the root directory of your website. There are two ways to access it:
- If you have cPanel access –
- Open the File Manager in your cPanel
- Go to WordPress installation directory
- Look for the wp-config.php file and open it in edit mode
- If you have FTP access only –
- Open your FTP account using an FTP client like FileZilla
- In the WordPress installation directory, look for the wp-config.php file
- Download the wp-config file to edit it on the local system
- Open the file in a text editor
Look for the line that reads ‘That’s all, stop editing! Happy blogging.’
Just before this line, you will find the following line:
Changing the value from “false” to “true” will turn on the debugging mode. WP_DEBUG is a PHP constant that can be used to initiate the “debug” mode throughout WordPress.
Note: If the line define(‘WP_DEBUG’, false); is not in your wp-config file, you can simply add it yourself. Make sure to change “false” to “true” and add it just before the line that reads ‘That’s all, stop editing! Happy blogging.’
The only drawback of using this debugging method is that you cannot hide it from your front end. It will appear both within your admin area and on the front page of your website.
By adding the following code to your wp-config.php file just below the WP_DEBUG line, you can ensure that each site error is recorded:
define( ‘WP_DEBUG_LOG’, true );
WP_DEBUG_LOG is a companion to WP_DEBUG. It causes all errors to be saved to a debug.log log file inside your /wp-content/ directory.
When you’re finished, save the changes you made to your wp-config file and upload it back to your site.
Reviewing Your WordPress Error Logs
To review your WordPress logs, you need to visit your WordPress site and access the pages that were producing the errors. After you’ve done that, connect to your website using any FTP client or file manager app on your WordPress hosting cPanel.
Once you are connected, go to your /wp-content/ folder. Inside it, you will find a file called debug.log.
This is the log file where all your errors are written. You can view this file and even edit or download it if you’d like. It contains all the WordPress errors, warnings, and notices that were logged.
That’s all there is to it. After you’ve completed the steps in this guide, you’ll be able to keep track of all the errors that happen on your site.
Did you find this article helpful? Do you have any questions? Let us know in the comment section below.
Know Everything About WordPress
Best Products in Your Inbox
Subscribe to our mailing list and we will surprise you with amazing WordPress freebies
Thank you for subscribing.