How to Find the Plugin Causing Issues Using wp-content/debug.log

How to Find the Plugin Causing Issues Using wp-content/debug.log

When troubleshooting WordPress issues, one of the most effective tools at your disposal is the debug.log file. This log can reveal PHP errors, warnings, and notices that can help you identify which plugin is causing problems on your website. In this guide, we’ll walk you through how to find the culprit simply by reading the wp-content/debug.log file.

Step 1: Enable Debugging in WordPress

Before you can use the debug.log file, you need to make sure that WordPress debugging is enabled. To do this, open your wp-config.php file (located in the root directory of your WordPress installation) and look for the following lines:

// Enable WP_DEBUG
define('WP_DEBUG', true);

// Log errors to debug.log file
define('WP_DEBUG_LOG', true);

// Prevent errors from being displayed on the front end
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

If these lines are missing, add them just before the line that says /* That's all, stop editing! Happy blogging. */.

Step 2: Locate the Debug Log File

Once debugging is enabled, WordPress will log errors to a file named debug.log inside the wp-content directory. You can access this file via FTP, your hosting file manager, or directly through SSH.

Step 3: Analyze the Log for Plugin Errors

Open the debug.log file using a text editor or a command-line tool like cat or tail. Look for error messages that mention a specific plugin path. Errors usually follow this format:

[22-Feb-2025 12:34:56 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function some_function() in /home/user/public_html/wp-content/plugins/problematic-plugin/plugin-file.php:123
Stack trace:
#0 /home/user/public_html/wp-includes/class-wp-hook.php(310): some_function()
#1 /home/user/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2 /home/user/public_html/wp-content/plugins/another-plugin/another-file.php(45): apply_filters()
#3 {main}
  thrown in /home/user/public_html/wp-content/plugins/problematic-plugin/plugin-file.php on line 123

In this example, the error clearly points to /wp-content/plugins/problematic-plugin/plugin-file.php at line 123. This tells you that the issue originates from the problematic-plugin plugin.

Step 4: Disable the Problematic Plugin

Once you’ve identified the plugin causing the issue, you can disable it in one of the following ways:

1. Via the WordPress Admin Panel

If your site is still accessible, go to Plugins > Installed Plugins, find the problematic plugin, and deactivate it.

2. Via FTP or File Manager

If your site is broken and you can’t access the admin panel, connect to your server via FTP or your hosting file manager. Navigate to wp-content/plugins/ and rename the folder of the problematic plugin (e.g., change problematic-plugin to problematic-plugin-disabled). This will automatically deactivate the plugin.

3. Via WP-CLI (if available)

If you have SSH access and WP-CLI installed, you can deactivate the plugin using the following command:

wp plugin deactivate problematic-plugin

4. Via Freesoul Deactivate Plugins

Of course, if you can access the FDP settings page, this is the easiest way to disable the problematic plugins where they gives issues.
If the issue occurs only on pages where you don’t need that plugin, you can even disable it only there, and keep it active where it doesn’t give issues.

Step 5: Clear the Debug Log and Test Again

After deactivating the plugin, delete or rename the debug.log file and reload your site. If the issue is resolved, you’ve successfully found the culprit.

If errors persist, repeat the process to check if another plugin is also causing issues.

Conclusion

Using wp-content/debug.log is one of the simplest and most effective ways to pinpoint a malfunctioning plugin. By carefully reading error messages and identifying the problematic file path, you can quickly diagnose and fix WordPress issues without unnecessary trial and error.

Next time your site breaks, don’t panic—just check the debug.log and follow these steps to get your site back on track!