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!