When things go wrong, it’s usually due to PHP or JavaScript issues, or a clash between your site’s theme and plugins. Furthermore, there could be caching issues preventing your site from displaying as expected or a function not working properly.
Follow the steps below to troubleshoot the problem on the WordPress site.
Determine Whether It Is a Caching Issue
Simply open your browser’s console and examine the request header to see if your site is cached.
Another approach is to view the page’s source code.
Determine Whether It Is a JavaScript Error
Most JavaScript errors will be shown in the browser’s console. Simply enable it and find the file coming with the issue. You might need to contact the plugin or theme’s author for further assistance.
Determine Whether It Is a PHP Error
PHP error will display in the debug.log file when you enable debug log mode in WordPress.
To do so, add the following code snippet to your wp-config.php file.
The debug.log file is located under wp-content/uploads directory by default. If it doesn’t exsit, simply create a new one. Otherwise, you can change the file location using the code below:
In fact, I often use plugin to display the error right under the Dashboard. All you need to do is to install plugin and activate it, the plugin will guide you how to do it. Nothing to remember and easy to follow
Determine Whether It Is a Conflict Issue
A theme or plugin conflict is the second most common cause of any WordPress problem.
This is the method that the author of the theme or plugin will recommend if you contact them.
Deactivate each plugin one by one or return to the default theme.
Actually, as a QA analyst and CS agent, it is my last choice.
It requires you to have a staging site so that you can make changes to the site without affecting the current users. Furthermore, maintaining a staging site necessitates time and effort.
That being said, it’s a quick and easy way to find a clue of what going wrong when none of the other methods are working.
Debugging Flow
Copy and paste the following constants to the wp-config.php file
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
Find log file under wp-content/debug.log or create a new one
- Install this plugin Query Monitor
- Clear browser cache
- Use Incognito mode
- Test conflict
- Deactivate all plugins
- Switch to other themes
- Switch to other sites
- Multisite / Single site
- Nginx / Apache
- Sub-directory / Sub-domain
- Downgrade plugin version
- Use browser developer tool
- Elements: check CSS
- Console: check JS
- Network: check the HTTP request
Setup WordPress Environment for Testing
- https://localwp.com/
- Downgrade WordPress version
- WordPress beta tester