The site worked yesterday, and today it shows only a white screen or the message "There has been a critical error on this website". The first reaction is usually guessing: clearing the cache, reinstalling WordPress, switching themes.

Guessing wastes time. Almost every WordPress error leaves an exact message in a log file that tells you which file and which line has the problem. This guide shows where to find that message and what to do about the most common errors.

What should you do first when WordPress shows an error?#

Find the exact error text before changing anything. If it is a "critical error", WordPress usually emails the admin a message naming the plugin or theme at fault, with a login link in recovery mode. Recovery mode means logging in to the dashboard while the broken plugin or theme is temporarily paused. Check the admin's inbox first.

Four common WordPress error symptoms, the first place to look and the usual fix for each

How do you turn on WordPress error logging safely?#

With constants in wp-config.php that write errors to a file but do not show them to visitors. Put these lines above the stop-editing line, and if WP_DEBUG is already there, only change its value:

PHP
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', '/home/USERNAME/wp-errors.log' );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', '0' );

The value of WP_DEBUG_LOG is the path of a file outside public_html, because the default path, wp-content/debug.log, can be viewed from outside. Replace USERNAME with your cPanel username.

The second place is the host's own log. cPanel usually writes PHP errors to a file named error_log in the same folder where the error happened, and cPanel's Errors section shows the latest web server errors. After you find the cause, set WP_DEBUG back to false.

How do you fix the white screen or "critical error"?#

In most cases by deactivating the plugin or theme named in the error log. In the error text, look for a path like wp-content/plugins/plugin-name/; that plugin is the culprit.

  1. In File Manager, open wp-content/plugins.
  2. Rename the folder of the plugin at fault, for example by adding -off to the end.
  3. Reload the site. If it comes back, that plugin was the cause.
  4. If the culprit is unclear, temporarily rename the whole plugins folder, log in to the dashboard, rename it back and activate plugins one by one.
  5. If the error comes from the theme, rename the theme's folder in wp-content/themes; WordPress falls back to one of the installed default themes.

Two other common causes: a PHP version change that an old plugin is not compatible with, and running out of memory with the message "Allowed memory size exhausted". For the first, temporarily roll back the PHP version in Select PHP Version and update or replace the plugin. For the second, before raising memory, find out which plugin is using it.

If the error appeared after you added code written by an AI assistant, remove that code first; the safe way to handle such code is in building a WordPress plugin with AI.

Where does the WordPress 500 error come from?#

From a broken .htaccess file, a fatal PHP error or wrong file permissions. A 500 error means the server ran into a problem handling the request but does not tell the browser the details; the details are in error_log.

  • .htaccess: rename it to .htaccess-old. If the site comes back, go to Settings → Permalinks and click Save without changes so WordPress creates a fresh file, then add your own extra rules back one by one.
  • File permissions: files 644 and folders 755. Permission 777 itself causes a 500 error on many shared hosts.
  • Disallowed setting: lines like php_value in .htaccess are not allowed on some hosts; set PHP options in Select PHP Version instead.

What causes the database connection error?#

The message "Error establishing a database connection" means WordPress could not connect to the database with the details in wp-config.php. The causes, in order of likelihood:

CauseHow to check
Wrong database name, user or passwordCompare the values with cPanel's MySQL Databases section
The user is not connected to the databaseIn the same section, add the user with all privileges
The database server is busy or unavailableIf it happens occasionally, ask your host's support
Damaged tablesWordPress's built-in repair tool

For the repair tool, temporarily add this line to wp-config.php, open your site's /wp-admin/maint/repair.php address and run the repair:

PHP
define( 'WP_ALLOW_REPAIR', true );

The repair page is available without logging in. Delete this line immediately after the repair.

If the error appeared right after moving the site, review the steps in migrating WordPress to a new host; a mismatched table prefix is also a common cause.

What are the other common WordPress errors?#

Six more errors, each with a nearly fixed cause that can be recognized even without the error log:

Message or symptomCauseFix
Briefly unavailable for scheduled maintenanceAn unfinished updateDelete the .maintenance file from the root
Too many redirectshttp and https mismatch in the site addressMake the addresses match
403 error when saving a postA host firewall ruleAsk your host's support for an exception
508 error or severe slownessHitting the resource limitCaching and removing extra load
"You do not have permission" after a migrationMismatched table prefixCorrect the prefix in the configuration
File upload failsPHP upload size limitRaise the value in Select PHP Version

For too many redirects, see HTTPS and mixed content on cPanel, and for 508, the 508 error and hosting resource limits.

How can AI help with troubleshooting?#

Give it the last few lines of the error log, your PHP and WordPress versions and what you have tried so far. Before sending, remove the database password, keys and email addresses from the text. The full method is in debugging with AI.

Where is WordPress troubleshooting heading?#

The directions are clear: WordPress has become more resilient to errors; recovery mode, the Site Health report and automatic rollback of a plugin update that breaks the site are examples. On the other hand, newer PHP versions are stricter, and code that once only gave a warning now causes a fatal error. That means most future errors will appear during PHP upgrades or from abandoned plugins.

To be ready:

  • Define the error log path outside public_html now, so it is ready on the day of an error.
  • Try PHP upgrades and big updates on staging first.
  • Keep the admin email real so the recovery mode message reaches you.
  • Replace plugins that have not been updated for a long time with an actively maintained alternative.

Summary#

  • Do not guess; first find the exact error text in the log.
  • Write the error log to a file outside public_html and do not display errors on the page.
  • Deactivate the plugin at fault by renaming its folder in File Manager.
  • For a 500 error, check .htaccess, PHP errors and file permissions.
  • For a database error, check the wp-config.php details and that the user is connected to the database.