Are you having trouble with errors and warnings? Want to set up WordPress error logs in wp-config file? Well, this is very easy to set up WordPress error logs and very helpful to debug an error or warning.
In this post, I am going to show you to set up WordPress error logs in wp-config.php file step by step.
Why To Set Up WordPress Error log In Wp-config file?
Wp-config is one of the crucial files of WordPress that contains settings for your website. These settings tell your website how to connect to the WordPress database. It is common that WordPress site faces error and warnings.
These errors and warnings can be solved very easily if the reason is detected easily. This can be done quickly from the WordPress error logs. By default, error logs are not enabled. To enable it you have to set up WordPress error logs in wp-config.php file.
How To Set Up WordPress Error Logs In WP-Config File
To Set up WordPress error login in WP-config file at first you have to connect your website with an FTP client like FileZilla or any file manager app in cPanel of your Website. After logging into your WordPress directory, you will find the wp-config.php file in the root directory.
I am using cPanel and from here I opened File manager. When you open the root directory you will find “wp-config.php”. Right-click on it and click on the Edit option.
Press Ctrl + F and search for ‘That’s all, stop editing! Happy publishing’. Now before this line insert the below code.
define( 'WP_DEBUG', true );
If you find that the code is already there and is set to false, then just set it to true.
This will turn on WordPress debug mode. If you want your errors to be logged then you need to add the following code in wp-config.php file, just below the WP_DEBUG line.
define( 'WP_DEBUG_LOG', true );
Now save changes.
Review Error Logs
To review error logs at first visit your website and access the pages that are causing errors or warnings. Now connect your website with FTP client or file manager of cPanel.
Navigate to /home/wp-content/ folder. Here you will find a file called debug.log.
Now right-click on the file and view it. You can also download it and open it on your computer. In this way, you can review errors from the error log.
I hope this helped you to set up WordPress error logs in wp-config file of your website. If you liked the post then please share it with your friends and don’t forget to leave your thoughts in the comment box below.