1. Home
  2. Blog
  3. How to Recover a Broken WordPress Site

How to Recover a Broken WordPress Site

When your WordPress site suddenly becomes unreachable or loses data, the cause is usually a technical configuration error or a server-side conflict. This guide offers professional solutions to systematically diagnose the problems you face and get your site working again as quickly as possible.

By meomanWordPress since 2008

How to Fix Database Connection Errors

The “Error establishing a database connection” message is one of the most common problems and means WordPress cannot reach its MySQL database. It usually happens after a password change in the hosting panel, when the database server stops responding or when database tables become corrupted. To fix it, first check that the username, password and host details in the wp-config.php file are current.

An overloaded database server or errors in SQL queries can also trigger this message. If the details are correct, enabling WordPress’s built-in database repair feature is a sensible next step. To do this, add a specific line of code to the wp-config file, start the automatic repair in your browser and fix the corrupted tables.

Although modern hosting platforms optimize databases automatically, manual checks still offer the most reliable solution. Clearing the database cache and deleting unnecessary “overhead” data improves connection speed and keeps such errors from recurring. On large sites in particular, the size of database tables can lengthen query times and lead to connection timeout errors.

  • Verify the DB_NAME, DB_USER and DB_PASSWORD fields in the wp-config.php file.
  • Check whether the database server (DB_HOST) is 'localhost' or a specific IP address.
  • Run repair mode by adding the line “define('WP_ALLOW_REPAIR', true);” to the wp-config file.

Checking Database User Privileges

Make sure the database user has all privileges on the relevant database. Hosting updates can sometimes reset or restrict user privileges.

  1. Go to the MySQL Databases section in cPanel or Plesk.
  2. Check whether the user is assigned to the database.
  3. Make sure the “All Privileges” option is checked.
Error typePossible causeRecovery toolDifficultyEstimated time
Database errorWrong credentialswp-config.php / FTPMedium10 minutes
White screen (WSoD)PHP memory limitError logsLow15 minutes
500 Internal Server ErrorCorrupted .htaccessFile managerLow5 minutes
404 Not FoundBroken permalinksWP admin dashboardLow2 minutes
Critical error messagePlugin incompatibilityRecovery modeMedium20 minutes

PHP Debug Mode for the White Screen Problem

The “White Screen of Death” in WordPress usually appears when a PHP error cannot be displayed in the browser. Your site shows up as a completely blank page, and the problem is usually triggered after a plugin update or a theme change. To find the source, you need to enable WordPress’s hidden debug mode.

Once debug mode is on, the white screen is replaced by technical error messages. These messages clearly show which file is failing and on which line. For example, if you see a path like “wp-content/plugins/plugin-name,” you know the problem comes from that plugin. That way, instead of wiping the whole site, you only work on the problematic file and save time.

An insufficient PHP memory limit is also one of the biggest triggers of the white screen error. Heavy plugins or functions that process high-resolution images can exceed the amount of RAM the server allocates. In that case, raising the memory limit via wp-config.php or the .htaccess file gets the site loading again.

  • In the wp-config.php file, change the “WP_DEBUG” value from “false” to “true.”
  • Use “WP_DEBUG_LOG” to save errors to a file instead of printing them on screen.
  • Add the code “define('WP_MEMORY_LIMIT', '512M');” to increase the memory limit.

Rebuilding a Corrupted .htaccess File

On Apache servers, the .htaccess file is a vital file that controls your site’s redirect rules and permalink structure. Adding a wrong redirect rule or a security plugin writing bad data into this file can make the whole site return a “500 Internal Server Error.” The fastest way to fix this error is to temporarily disable the current .htaccess file.

When you rename the file to “.htaccess_backup” via FTP, the server falls back to its default settings, and if the problem was in this file, your site opens right away. Once your site is back, go to “Settings › Permalinks” in the WordPress admin dashboard and simply click “Save Changes” without changing anything. This makes WordPress generate a clean, working .htaccess file.

Today, the .htaccess file is used not only for redirects but also for firewall rules. Complex IP-blocking rules added to the file can sometimes lock out legitimate users and even the site owner. That’s why, during recovery, the safest approach is to simplify the file and leave only WordPress’s standard code block.

  • Find the .htaccess file in the root directory using FTP or the file manager.
  • Rename the file so the server ignores it.
  • Generate a new file by saving your permalinks in the WordPress admin dashboard.
Related serviceWordPress Backup Setup

5 WordPress Recovery and Backup Plugins

When you can’t recover your site manually, backups taken in advance are a lifesaver. AI-powered backup tools can spot problems on your site early and warn you. And when a crash does happen, their “one-click restore” features can get you back online within minutes.

When choosing a recovery plugin, prefer tools that back up not only your files but your full database as well. Some plugins store backups on the local server, while professional tools send them to cloud storage (Google Drive, Dropbox, etc.). That way, you can reach your data from elsewhere even if your server goes down completely.

The five tools we list are among the most reliable options for both beginners and professional developers. They check your site’s file integrity and automatically resolve database mismatches that can occur during a restore.

  • UpdraftPlus: One of the most widely used backup tools worldwide, with cloud backup support.
  • Duplicator: Ideal for moving a site to another server or rebuilding it from scratch on the current one.
  • Jetpack Backup: Saves every change instantly with real-time backups.
  • BlogVault: A cloud-based service known for its high success rate in difficult recovery operations.
  • WP Reset: Used to reset specific parts of the site, or the whole site, to factory settings.

Source: WordPress.org Plugin Directory

Manually Repairing Core Files via FTP

In some cases, WordPress’s main files (core files) can be damaged or incompletely uploaded. This usually happens during a failed automatic update or a server outage. Re-uploading the WordPress core files manually via FTP is the most robust way to refresh the system without harming the database or the “wp-content” folder.

The most critical rule during a manual repair is never to touch the “wp-content” folder or the “wp-config.php” file, because all your themes, plugins and images live in that folder. Replacing the “wp-admin” and “wp-includes” folders on the server with those from the latest version downloaded from the official WordPress site repairs the system’s core structure.

This method is also an effective cleanup step when your site has been infected with malware. Foreign code that has slipped in among the core files disappears when the clean files overwrite them. When transferring files via FTP, making sure “Binary” mode is selected and that all files transfer successfully determines whether the recovery succeeds.

  • Download the latest WordPress ZIP file from WordPress.org.
  • Upload all files in the ZIP via FTP, except the “wp-content” folder.
  • Confirm the option to overwrite existing files.

Restoring Backups on the Server Side

If your access to the WordPress admin dashboard or FTP is restricted, you need to recover through the control panel your hosting company provides (cPanel, Plesk, etc.). Modern hosting companies usually store daily backups for the last 30 days automatically. These backups are a full system image covering both your site’s files and its database.

Using tools such as “Backup Wizard” or “JetBackup” in your hosting panel, you can roll back to a date when your site was working without problems. This usually takes a few minutes and is carried out automatically by the server. Before restoring, however, take a backup of the current (broken) state as well, so you can go back if things get even worse.

When restoring server-side backups, pay attention to PHP versions and database engine compatibility. For example, if your site was backed up on PHP 8.3 and your current server setting is PHP 7.4, you may get compatibility errors after the restore. So make sure the server configuration matches the date of the backup.

  • Log in to your hosting control panel and find the 'Backup' or 'Restore' section.
  • Choose the most recent backup from a time you are sure your site was working properly.
  • Restore both the file system and the SQL database from backups of the same date.

Malware Cleanup and Data Integrity

Your WordPress site may have crashed because of a cyberattack or a malware infection. In such cases, simply restoring from a backup is not a permanent fix, because the site will crash again as long as the hole the attacker used remains open. As part of the recovery process, resetting all user passwords and updating the security keys (salts) is mandatory.

Malware usually hides inside critical files such as “index.php” or “functions.php.” After recovering your site, scan all directories with a professional security scanner and remove suspicious code blocks. Removing outdated plugins that are no longer supported also minimizes future crash risks.

To protect data integrity, checking file permissions after recovery is vital. 755 for folders and 644 for files are the standard, secure values. Misconfigured permissions can let attackers regain write access to the file system or cause the server to block the site.

  • Change all admin, FTP and database passwords to new, complex ones.
  • Update the 'Authentication Unique Keys and Salts' section in the wp-config.php file.
  • Run an in-depth security scan of your site with tools such as Wordfence or Sucuri.

Source: Google help for hacked sites

Frequently Asked Questions

1. Can I recover my site if I have no backup?

Yes. You can check for backups your hosting company takes automatically, or fix the problem by manually replacing the core files. If the database is intact, the files can be rebuilt.

2. I can’t get into wp-admin. How do I disable plugins?

You can disable all plugins by renaming the “wp-content/plugins” folder via FTP. This deactivates the faulty plugin that is blocking access to the dashboard.

3. Can changing the PHP version save my site?

If your site uses an outdated theme or plugin, downgrading the PHP version (for example, from 8.2 to 7.4) can temporarily bring the site back up. In the long run, however, you should update all components.

4. Will a database repair delete my data?

No. WordPress’s built-in repair tool only tries to fix corrupted table indexes and structures. Your existing content, posts and pages are not affected.

5. I deleted the .htaccess file. Why is my site still not loading?

If the problem isn’t caused by .htaccess, deleting the file may not help. In that case, check the PHP error logs to determine whether the problem is a plugin or a server error.

Recovering a WordPress site is a technical process that, with the right diagnosis and a systematic approach, can almost always be completed successfully. Getting into the habit of regular backups and following security protocols will keep your site well protected against future crashes.

Summary
This article explained how to repair crashes and access problems on WordPress sites with current techniques, covering every detail from database errors to malware cleanup.