WordPress debug

WordPress debug

WordPress troubleshooting 101:  add the following to wp-config.php to enable displaying errors.

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 1 );
define( 'SCRIPT_DEBUG', true );

Note: Debugging is used for development purposes only, make sure to disable it again after you are done troubleshooting.

Here is the list of most common WordPress errors:

  • The White Screen
  • Internal Server Error
  • Error Establishing Database Connection
  • Failed Auto-Upgrade
  • Connection Timed Out
  • Maintenance Mode Following Upgrade
  • PHP errors or MySQL DB errors

Clear Cache

Flushing any caching plugins you might be running, as well as server and/or browser caches. Not just your browser, but any op cache or content network cache as well such as Cloudflare. That will solve many weird JavaScript issues.

Flushing Managed host caches. Managed WP hosting often has special caches. If your host has a “Purge Varnish” or “Flush Memcache” tool, try that. You can ask your provider to flush memcache and Varnish for you if necessary.

Resave WordPress permalinks
Resave WordPress permalinks

In a few cases, I’ve seen third-party installers, such as Softaculous, creating sites with slightly incorrect rules in the .htaccess file. While these rules would not have been a problem in previous versions, having these incorrect rules can break the REST API in newer versions. Resaving the permalinks on the Settings->Permalinks page in WordPress will fix these rules in the .htaccess file, and possibly fix “failed” errors in the new editor.

Deactivating WordPress plugins

90% of all WordPress problems come from WordPress plugins, so the first thing to do when troubleshooting WordPress problems is to disable all plugins (yes, all). If this works, re-activate the plugins one by one until you find the problematic plugin(s)

How to deactivate all plugins when not able to access the admin dashboard?

Deactivate WordPress plugins from the database using phpMyAdmin

One way to disable all plugins is to log into the datbase from the PHPMyAdmin and selecting the database, then:

  1. In the table wp_options, under the option_name column (field) find the active_plugins row
  2. Change the option_value field to: a:0:{}
Disable WordPress plugins from PHPMyAdmin
Disable WordPress plugins from PHPMyAdmin

Deactivate WordPress plugins from File Manager or FTP

This method preserves plugin options but requires plugins be manually reactivated.

  1. cPanel File Manager or FTP, navigate to the wp-content folder (directory)
  2. Rename the folder “plugins” to “plugins.old”
  3. Login to your wp-admin plugins page (/wp-admin/plugins.php) – this will disable any plugin that is “missing”.
  4. cPanel File Manager or FTP, rename “plugins.old” back to “plugins”
Disable WordPress plugins from File Manager or via FTP
Disable WordPress plugins from File Manager or via FTP

Did deactivating all the plugins fixed the problem? Great, now enable them one by one at a time until you find the source of the issue.

Switch to default WordPress theme

To check if the root problem is your active WordPress theme, switch back to the default WordPress theme. As for the plugins, we can do by removing or renaming the active theme directory via File Manager or from the database.

Switch to the Twenty Twenty theme to rule out any theme-specific problems. If you can’t log in to change themes, you can remove the theme folders via SFTP/FTP so the only one is twentytwenty. That will force your site to use it.

Deactivate WordPress theme from the database using phpMyAdmin

  1. In the table wp_options, under the option_name column (field) find the template and stylesheet rows
  2. Change the option_value field with a default theme, like twentysixteen
  3. Do the same for stylesheet row
Deactivate WordPress theme from the database using phpMyAdmin
Deactivate WordPress theme from the database using phpMyAdmin

Deactivate WordPress theme from File Manager or FTP

This method preserves theme options but requires theme be manually reactivated.

  1. cPanel File Manager or FTP, navigate to the wp-content folder (directory) and then “themes”
  2. From this folder rename your active theme name to“theme.old”
  3. Login to your wp-admin themes page (/wp-admin/themes.php) – this will disable the active theme and switch back to the default one.
  4. After that from cPanel File Manager or FTP, rename back the theme name from “theme.old” to “theme”.
Disable WordPress theme from File Manager or via FTP
Disable WordPress theme from File Manager or via FTP

The theme is now changed and your website is accessible again and you can log in to your wp-admin dashboard.

Manually Upgrade WordPress

Try MANUALLY updating. When all else fails, download a fresh copy of the latest.zip file for this release (top right on this page) to your computer, and use that to copy up. You may need to delete the wp-admin and wp-includes folders on your server (NOTE: do not delete the wp-content directory or your wp-config.php file). Please read the Manual Update directions first.

BACKUP: If you haven’t already done, always backup everything (including your database) before doing any actions, just in case something really goes wrong. You can never have enough backups! See https://wordpress.org/support/article/wordpress-backups/

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.