Debugging WordPress
Debugging in WordPress is an essential process for identifying and fixing errors, issues, or unexpected behavior on your site. WordPress has a built-in debugging feature that allows developers and site admins to log errors, display PHP notices, and troubleshoot issues efficiently.
Enable Debugging in WordPress
To enable debugging, you need to modify the wp-config.php file located in the root directory of your WordPress installation.
Step 1: Open the Config File
nano wp-config.php
Step 2: Add the Debug Code
Look for the line that says /* That's all, stop editing! Happy blogging. */. Just before that line, add the following:
// Enable WordPress debugging
define('WP_DEBUG', true);
Once saved, refresh your website. You should now see specific error messages instead of a generic "Critical Error" screen.
Common Debugging Tips
A. Disable All Plugins
- Rename the
pluginsfolder to something likeplugins_oldvia FTP or SSH to deactivate all plugins instantly. - If the site works without plugins, reactivate them one by one to identify the culprit.
B. Switch to Default Theme
If the issue is theme-related, switch to a default theme like Twenty Twenty-Four.
- Dashboard: Go to Appearance > Themes and activate a default theme.
- FTP/SSH: Navigate to
wp-content/themesand rename your current theme's folder. WordPress will automatically fall back to the default.