How To Troubleshoot & Debug WordPress Website Without Issues
This post is specifically for WordPress users who want to learn how to troubleshoot and debug WordPress.
Sometimes your WordPress site may run into numerous problems that you can’t pinpoint what the actual cause is.
It’s possible your site might just become unnecessarily slow. Or some of its functions may just stop working, or even just start misbehaving or start displaying some errors.
When you come across such a problem, you may want to troubleshoot your site to see if the issue will be resolved.
It is vital to learn how to troubleshoot the WordPress website. Knowing this will save you, not just money, but also time.
In most cases, the issues that arise in WordPress are minor and can be resolved in a few minutes. For this reason, every WordPress user is expected to learn how to troubleshoot the WordPress framework.
WordPress Troubleshooting Steps
1. Create Backup of Entire WordPress
It is very necessary for every WordPress website to have a backup plugin that backup the site externally at a regular interval.
If you have a backup plugin installed and activated on your site, then make sure you have the latest backup. But if you don’t have a backup plugin, you may need to install it first and backup your site.
In the absence of backup plugins, or the issue with your site is preventing you from login as admin you can run a cPanel backup for your backup directory and database.
The main essence of backup is to have a copy of your site so if anything goes wrong your website can be restored to its previous position.
2. Crosscheck All Settings
The second step when troubleshooting WordPress, is to crosscheck all your site settings carefully one after the other; this includes the plugins and themes settings. Also crosscheck site URL and permalinks carefully.
It’s possible you may have altered a setting that you are not aware of, or some who have access to the admin may be ignorant of it.
3. Deactivate All Plugins Installed On Your Site
This solves the problem in most cases, WordPress errors mostly is due to conflicting plugins. After deactivating all plugins if the issue is resolved, then you have to start activating the plugins individually to know which is the cause of the problem.
If you don’t access your admin, you can also deactivate the plugin via your cPanel.
To do this simply login into your cPanel, go to the directory where the affected WordPress is installed. Depending on your server, this is mostly found in the file manager.
After you must have found the directory, located wp-contents > plugins, you will see the list of all your plugins. You can deactivate plugins by renaming them one after the other.
4. Switch Over To WordPress Default Theme
If step 3 did not solve the problem, then, the problem may be with your theme. If you aren’t using your WordPress default theme, then you have to switch your theme to the default theme your WordPress came with. Your default theme may be Twenty Seventeen or Twenty Eighteen, Twenty Nineteen as the case may be.
5. Enable ‘WP_Debug’
If the problem persists after step 4, then you may consider enabling the WordPress debug.
WordPress included a hidden debugging feature to make it easier to determine where a problem is occurring.
The Debugging feature is meant explicitly for developers. If you are not a web developer, you may need to contact codex.wordpress.org to know what to do.
How To Debug WordPress
WordPress has made debugging so easy. It can be done by simply adding some specific lines of code within your “wp-config.php” it will activate the WordPress debugging feature.
Although debugging is not recommended to be done online. Alternatively, you may consider downloading a copy of your WordPress site and debug it on a local server. It all depends on what is more convenient for you.
To debug your WordPress website or blog, open your “wp-config.php,” The file can be found on your WordPress directory.
Once you have opened the file with your editor, make space to paste the piece of code below into it.
// Enable WP_DEBUG mode define('WP_DEBUG', true); // Enable Debug logging to the /wp-content/debug.log file define('WP_DEBUG_LOG', true); // Disable display of errors and warnings define('WP_DEBUG_DISPLAY', false); @ini_set('display_errors', 0); // Use dev versions of core JS and CSS files (only needed if you are modifying these core files) define('SCRIPT_DEBUG', true);
Breaking Down The Codes
// Enable WP_DEBUG mode define('WP_DEBUG', true);
WP_DEBUG alone will authorize WordPress to display all error messages on screen.
// Enable Debug logging to the /wp-content/debug.log file define('WP_DEBUG_LOG', true);
WP_DEBUG_LOG together with WP_DEBUG will authorize WordPress to save all recorded error information to the “debug.log” file which can be located in the “wp-content” directory.
// Disable display of errors and warnings define('WP_DEBUG_DISPLAY', false); @ini_set('display_errors', 0);
If WP_DEBUG_DISPLAY and WP_DEBUG lines are pasted, WordPress will not display the error and warning messages on web pages. By default, it is enabled.
// Use dev versions of core JS and CSS files (only needed if you are modifying these core files) define('SCRIPT_DEBUG', true);
define( 'SAVEQUERIES', true );
SAVEQUERIES will save all the database queries to an array that can be displayed to help analyze them. Array is stored in global $wpdb->queries.