When working with your website, different themes, and plugins, youโll inevitably encounter some problems. This is where debugging can help.
Debug mode helps find and fix problems on your website by showing detailed error messages.
Common Conflicts and Their Solutions
Installing a new plugin or theme, updating, or adding a custom code can cause conflicts. Some issues will show immediately and can even make your website temporarily unusable (e.g., theย White Screen of Death).
Others will show only in certain situations and create issues with some functionality or plugin. These issues can often be solved by manually deactivating all of your plugins and re-activating them individually. This way you can find which plugin is creating the issue.
Further, you can switch to another theme to check if the issue is coming from that side. All of this takes a lot of time.
How Debug Mode Simplifies Troubleshooting
If you enable the debug mode, it will display a log of PHP errors and warnings. This can help you quickly find the source of the issue.
You could even use this to prevent some issues. Some errors, if they exist, will only be visible in the debug log even though everything seems fine on your website.
You can enable debug mode manually or using a plugin. We will show you how to do it using both methods.
Note: No matter which method you choose, Itโs advisable to do this in your staging environment (same as your new installations, updates, etc.) as errors will become visible on both your front end and dashboard.
Method 1: Enable the Debug Mode Using a Plugin
If youโre unsure about working with your website files or find Method 2 too complicated, the WP Debugging plugin is the right solution for you.
You can enable debugging using the plugin by following these steps:
Step 1: Navigate to Plugins > Add New from your WordPress dashboard.
Step 2: Type “wp debugging” in the search bar.
Step 3: Click the โInstallโ button on the WP Debugging. Once the plugin is installed, click on the โActivateโ button.
Step 4: Navigate to the Dashboard > Tools > WP Debugging;
Step 5: Click on the check box next to the โSet WP_DEBUG to trueโ option and click on the โSave Changesโ button.
Donโt forget to disable the debug mode after youโre done.
Method 2: Enable the Debug Mode Manually
Alternatively, if you prefer to do this manually and have no problem with editing your website files, or youโre locked out of your website (e.g., White Screen of Death) and donโt have another option, we will show you how this could be done by editing your wp-config.php file.
How to Access the “wp-config.php” File?
Before making any changes to any of your files, please create a complete backup of your website. Also, it is advisable to make a copy of the original file before editing it โ in case something goes wrong, you can always use this original file to start over.
For this article, weโll use the FileZilla FTP client, so please install it on your computer (unless you are familiar with another FTP client you would prefer to use). Letโs start:
Step 1: Add your FTP access data to FileZillasโ Site Manager
Step 2: Connect to your server
Step 3: Navigate to your websiteโs public_html (root) folder. Here you should find the found your wp-config.php file.
Step 4: Right-click on the file and select โDownloadโ to copy the file to your computer.
Step 5: Open the file using the code editor to edit it. You can edit the file using code editors like Sublime Text or Notepad++.
Step 6: Scroll down to the โThatโs all, stop editing! Happy publishingโ line
Step 7: Add the following value before that line and save changes:
define( 'WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true);
Step 8: Once you modified your file, just upload the file back to your server (using the FTP client), replacing the original file with this modified one.
By following these steps, you will enable your debug mode and create a debug.log file where your errors will be saved.
To disable the debug mode once youโre done, repeat the steps for enabling, just this time, either completely remove the previously added code or modify it as follows:
define( 'WP_DEBUG', false);
How to Use the Debug Mode?
If youโre trying to debug some issue youโre currently experiencing, youโll need to repeat the steps that led to this issue once your debug mode is enabled.
This will make a new error log, and youโll be able to check it out.
Viewing the Debug Log
If you are using Method 1:
Click on the โDebug Quick Lookโ menu in your admin bar on the top of your Dashboard screen. In the dropdown menu, click the โView Fileโ option. This will open a new tab showing the errors in the debug log.
For Method 2:
To manually access your site files, navigate to the following path: “public_html/wp-content/debug.log” and open the file to view the errors in the debug log.
That’s it! We hope this article helps you. If you face any issues while debugging, feel free to reach out to us!