Enable Debugging in WordPress, The right way
WordPress comes with a built-in debugger that can be enabled when needed. Before you can start troubleshooting issues on your website, you need to activate the debugging in WordPress.
Developing and running a website can be challenging sometimes, especially if your website encounters a fatal error or simply start crashing.
Luckily, WordPress comes with a debugger that will help you find out the cause of the issue and solve it.
Enabling the WP Debug
To enable the Wp Debug, you will need to access your WordPress website files using FTP or File Manager.
Then access the root folder of your WordPress website. It’s usually public_html or www, depending on the server type.
Now, look for the file wp-config.php and open it up for editing.
Scroll down thru the wp-config.php file and locate the line that holds this comment:
/* That’s all, stop editing! Happy publishing. */
Now paste this code above the mentioned comment and save the changes.
// Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug logging to the /wp-content/debug.log file define( 'WP_DEBUG_LOG', true );
The code will enable the WP Debug and it will also create a log file inside wp-content directory. You can access this log file and look for the errors.
Useful plugins to help you with debugging WordPress websites
Besides the regular debugging process, you can also install some plugins that will help you in troubleshooting the issues faster.
This is a very useful plugin that can help with troubleshooting as besides analyzing DB queries, this plugin also displays lots of data. It will display all DB requests, all hooks, and objects and it will display any PHP error present as well.
This simple plugin adds the debug bar with useful information on queries, cache, and other information that could help in solving the issues.
If you need to check how the cron job is performing and if there are any issues with it, this plugin is definitely worth checking out.
The aim of this article is to show you the basics of enabling WP Debug. There are some additional options for advanced usage, like saving queries for further analysis.
We love your feedback, please share any comments you might have and feel free to ask for help.