Errors in WordPress are common almost everytime you do something with your blog. You may be installing a plugin or setting up something with your WordPress theme, suddenly you will be ending up with an annoying error.
This happens to every WordPress user, not just you and me. Depending on the complexity of the problem, you will be struggling to resolve it.
There come the Error Logs.
- Error logs are a way to identify what is happening inside WordPress. It shows all the error messages and using that you get a clue to fix those errors.
- By default, error logs in WordPress are not enabled. You have to manually enable it.
The next time when you are into a WordPress issue, you can simply enable the error logs. Reproduce the issue. Read the error logs and understand what exactly caused the issue.
Based on the error logs, you can fix the issue yourself or pass it to your developer for an easier fix.
In this article, I will take you through the correct steps to enable error logs in WordPress so that you don’t need to struggle a lot.
- Login to your web hosting cPanel.
- Open the File Manager as shown in the below screenshot. The file manager is the cPanel tool used to manage the files hosted on your web server.
- Navigate to the root folder of your blog where you can locate the wp-config.php file.
- Select the wp-config.php file, click Edit and add the following lines to it:
- define (‘WP_DEBUG’, true);
- define (‘WP_DEBUG_LOG’, true);
- Save the wp-config.php file.
- Done, now you have correctly enabled the error logs.
Once you saved the wp-config.php file, try to reproduce the issue again.
That means now onwards whenever you see the issue, WordPress adds all the errors as debug prints into the log files. The log files are stored in the same root directory of the blog with the filename debug.log.
In fact, not just errors whatever debug prints added in the WordPress core are all logged into the debug.log file.
List of WordPress plugins to enable error logs:
- Log deprecated notices plugin – a WordPress plugin to quickly check all the deprecated API calls and helps to clean up your WordPress blog code.
- Debug This plugin – helps to easily enable error logs from the WordPress dashboard, it has the option to debug the backend database too.
The easiest way to enable error logs is to open the wp-config.php file, add the lines define (‘WP_DEBUG’, true); define (‘WP_DEBUG_LOG’, true); and Save it. Now error logs will be enabled and stored in the file debug.log.
I hope you are able to enable error logs on your WordPress blog. If you find any other way to enable WordPress debug logs, please leave a comment, it may be helpful to other WordPress users.