# Fix common WordPress errors

> Fix WordPress errors on hosting: turn on the debug log, recover from a critical error, a white screen or a database connection error, and fix memory and 404s.

Difficulty: Intermediate

When WordPress fails, the message on screen is only a hint. The real cause, usually a **plugin**, a **theme**, the **database settings** or a **PHP limit**, is written in a log. This guide shows how to read it and fix the most common errors.

## Before you start

- Open the site's files with your panel's **File Manager** or over SFTP; see [upload website files](/guides/upload-files-ftp-sftp).
- The WordPress root folder holds `wp-config.php`, `wp-admin`, `wp-content` and `wp-includes`.
- Download a copy of any file before you edit it.

## Step 1: Turn on the debug log

Open `wp-config.php` and add these lines above the line `/* That's all, stop editing! Happy publishing. */`. If `WP_DEBUG` is already defined, change that line instead of adding a second one.

```php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
```

Reload the broken page, then open `wp-content/debug.log`. The newest lines are at the end. A path such as `wp-content/plugins/example-plugin/` or `wp-content/themes/example-theme/` names the plugin or theme at fault.

> **Warning**
>
> The log can show file paths and other details. When you are done, set `WP_DEBUG` back to `false` and delete `wp-content/debug.log`.

## "There has been a critical error on this website"

WordPress has caught a PHP fatal error and emails the site's admin address a link to **recovery mode**.

1. Open the link from the email and sign in. WordPress pauses the plugin or theme that failed, for your browser only, and names it in a notice.
2. Deactivate that plugin (or switch to another theme), then update or replace it.
3. Leave recovery mode with the button in the admin bar.

**Verify:** the site loads for visitors in a private browser window. If no email came, the debug log from step 1 names the file instead.

## A white screen, or you cannot reach the dashboard

1. In `wp-content`, rename `plugins` to `plugins_old`. WordPress then runs without plugins.
2. If the site works now, rename the folder back to `plugins`, then rename one plugin folder at a time (for example `example-plugin` to `example-plugin.off`) until you find the one that breaks the site.
3. If the site is still white, rename the active theme's folder in `wp-content/themes`. WordPress switches to a default theme such as Twenty Twenty-Five, if one is installed.

**Verify:** the dashboard opens. Under **Plugins**, activate the other plugins again one by one.

## "Error establishing a database connection"

WordPress cannot sign in to its database. Usually one of the four settings in `wp-config.php` is wrong:

```php
define( 'DB_NAME', 'database_name_here' );
define( 'DB_USER', 'username_here' );
define( 'DB_PASSWORD', 'password_here' );
define( 'DB_HOST', 'localhost' );
```

1. In your panel, compare the database name and the database user with `DB_NAME` and `DB_USER`. On cPanel both carry your account name as a prefix, for example `account_wp1`.
2. Check that the user is assigned to that database with all privileges.
3. If you are not sure about the password, set a new one for the database user in the panel and put it in `DB_PASSWORD`.

See [databases and phpMyAdmin](/guides/hosting-databases-phpmyadmin). If all four settings are right and the error stays, open a ticket.

## "Briefly unavailable for scheduled maintenance. Check back in a minute."

An update stopped before it finished and left the `.maintenance` file behind. Delete `.maintenance` in the WordPress root folder (turn on hidden files in File Manager to see it), then run the update again under **Dashboard › Updates**.

## "Allowed memory size of … bytes exhausted"

A plugin or theme needs more PHP memory than allowed.

1. Raise `memory_limit` for the site in your panel; see [PHP version and settings](/guides/hosting-php-version-settings). WordPress keeps the PHP limit when it is higher than its own setting, so this is usually all you need.
2. If `wp-config.php` sets `WP_MEMORY_LIMIT`, or a plugin asks you to set it, use a value no higher than your PHP `memory_limit`, above the "stop editing" line:

```php
define( 'WP_MEMORY_LIMIT', '256M' );
```

If the error comes back with more memory, the plugin named in the debug log has a problem; update or replace it.

## Posts and pages show 404 errors

Open **Settings › Permalinks** and click **Save Changes** without changing anything. WordPress writes its rewrite rules again. If that does not help, check that `.htaccess` in the WordPress root folder contains this block:

```apache
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
```

## A redirect loop after changing the site address

If you changed the addresses under **Settings › General** and can no longer sign in, set them in `wp-config.php`. These lines override the values in the database:

```php
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
```

Use the same `https://` address in both, and make sure the certificate is active first; see [turn on free SSL and force HTTPS](/guides/hosting-free-ssl-https).

## Timeouts and slow admin pages

Heavy plugins can ask more of the server than your plan allows. Deactivate the plugins you do not need, switch to a default theme to test, and turn on caching; see [LiteSpeed Cache](/guides/wordpress-litespeed-cache). For 508 errors, see [fix 500, 403, 404 and 508 errors](/guides/hosting-500-403-errors).

## Next steps

- Prevent the next problem: [secure a WordPress site](/guides/secure-wordpress-site).
- Before big updates: [back up and restore your hosting account](/guides/hosting-backup-restore).

## Frequently asked questions

### Where are my WordPress files?

In the site's folder on the hosting account, which you open with your panel's File Manager or over SFTP. wp-config.php sits in the WordPress root folder, next to wp-content.

### Will renaming the plugins folder delete my plugins or their settings?

No. WordPress deactivates the plugins it cannot find, and their settings stay in the database. Rename the folder back and activate the plugins again.

### I got no recovery email after a critical error. What now?

Check the spam folder of the site's admin email address. If nothing arrived, turn on the debug log: it names the file that caused the error.

### Can you fix it for me?

Open a ticket with the exact error message and what changed before it started. We check the server side and help you find the cause.

---

Source: <https://hyperdc.com/guides/products/fix-wordpress-errors>\
Updated: 2026-10-16
