WordPress is stable, secure and keeps getting new updates each month but you are bound to encounter site errors at some point in your WordPress journey. These errors can come anytime due to issues and conflicts in plugins, themes, etc and you would have no idea how to fix them. This is where WordPress debug mode comes in and helps you find the error.
Once you enable the debug mode, you can find the bug that was causing the error in the first place. Now all you need to do is to figure out how to fix this error but at least the error messages in debug mode give you a pointer on how to fix the error.
Let’s learn ways to enable WordPress to debug mode.
How to enable WordPress Debug Mode for your WordPress website in 2 Easy Ways.
Want to enable WordPress to debug mode to fix your site errors? There are two ways to make it happen.
- Open wp-config.php file and add a code.
- Install and use a plugin to enable debug mode.
1. Enable debug mode manually using wp-config.php file.
You need to access your WordPress core files. To do so, you either have to go to file manager in your hosting by going to your shared hosting account or you can download a file manager plugin to browse your WordPress files.
Be careful not to touch all the database config or delete any keys here as this can cause a white screen or database connection error etc. Be Very Cautious!
Make sure that if you are using a file manager plugin instead of going manually to your hosting backend to change the wp-config file. It’s best to take a backup first and have SFTP software ready to access the core location in case something goes wrong.
You can download SFTP client software like FileZilla or Cyberduck. I have used both of them and they are very reliable. Next, find your SFTP details from your hosting provider or they have sent it to you via E-mail.
If you are using shared hosting like siteground – they have a backup solution in place – please take a backup first before proceeding with this tutorial. In general, always take a backup before doing anything risky.
Once you have SFTP & a backup ready. Let’s begin by going into your SFTP or file manager plugin and connecting to the server’s root directory (it’s called www or public_html usually). Once connected – browse to the wp-config.php file and right-click to download or edit it.
You can edit the file using any text editor like notepad++. Once you have opened the file – put this code below after the “/* That’s all, stop editing! Happy blogging. */” line.
define( ‘WP_DEBUG’, true);
Once you have fixed the bug, remember to disable WP_DEBUG using false instead of true in the code or you can remove the line totally and re-save it.
2. Enable debug mode using a dedicated plugin.
If you don’t want to enable the debug mode manually, you can use a plugin to automatically enable the debug mode. This makes it easy to do so and you don’t have to go into your backend and tinker with the files. There are many plugins for enabling wp debug mode but one we like is the “WP Debugging” plugin. It’s the best and often updated.
Once installed and activated. The plugin inputs 3 lines into your wp-config.php file automatically.COPY CODE
define( ‘WP_DEBUG’, true ); define( ‘WP_DEBUG_LOG’, true ); define( ‘SCRIPT_DEBUG’, true ); define( ‘SAVEQUERIES’, true );
The bottom two lines aren’t necessary if you are not a developer. You would only need the top two code lines. It’s a very useful plugin but if you are comfortable with the manual method considering now that you have the knowledge of it, adding an extra plugin doesn’t make any sense.
WordPress is a powerful CMS and anything can go wrong with the plugins and themes that you install into it. If something goes wrong it’s best that we have this feature to point us in the right direction to fix our site errors to get our website up and running again.
If you have any other doubts about WP_DEBUG mode. You can comment down below and I would love to help you. Thank you for reading this article.