The Ultimate Guide to WordPress Site Repair
When Your WordPress Site Breaks: What to Do First
WordPress site repair is the process of diagnosing and fixing a broken, hacked, or malfunctioning WordPress website so it works correctly again.
Here are the most common WordPress site repair steps, in order:
- Back up your site before touching anything – files and database
- Identify the cause – plugin conflict, corrupted file, malware, or database error
- Disable all plugins and switch to a default theme to isolate the issue
- Check your error logs for specific PHP or server errors
- Repair or replace the affected files, database tables, or infected code
- Test thoroughly before bringing the site back online
- Harden security to prevent the same issue from happening again
If your site is showing a white screen, a 500 error, a “Error Establishing a Database Connection” message, or has been hacked, the sections below walk you through every fix step by step.
WordPress powers over 40% of the web – but that popularity also makes it a frequent target for hackers, and its flexibility means there are plenty of ways things can go wrong. A single bad plugin update, an outdated PHP version, or one piece of malicious code can take your site offline in seconds. For small business owners, that downtime translates directly into lost revenue, damaged credibility, and a drop in search rankings.
I’m Kevin Gallagher, founder of wpOncall and a WordPress specialist with over 15 years of experience in WordPress site repair, maintenance, and security – with more than 2,500 WordPress websites built and hundreds actively managed. In this guide, I’ll walk you through every repair scenario clearly, so you can get your site back online fast.
Quick WordPress site repair definitions:
Why WordPress Sites Break, Slow Down, or Get Hacked
Understanding why a website breaks is the first step toward fixing it. In our experience resolving over 20,000 WordPress issues, we have found that almost all downtime can be traced back to a handful of culprits.
First, plugin and theme conflicts are the leading cause of sudden crashes. WordPress relies on an open ecosystem where different developers write code independently. When you update a plugin, it might use a PHP function that conflicts with another active plugin or your active theme, resulting in a fatal runtime error.
Second, running an outdated core version of WordPress or outdated PHP settings on your server creates massive security vulnerabilities. As web standards evolve, older code becomes incompatible with modern hosting environments. For instance, running a site built for PHP 7.4 on a server that has been upgraded to PHP 8.2 can trigger immediate failure. You can learn more about supported versions and syntax updates in the official PHP documentation.
Third, server resource limitations often trigger slow performance or unexpected timeouts. If your hosting environment lacks sufficient memory or processing power to handle database queries, your server may simply give up, serving a 500 Internal Server Error to your visitors.
To help you understand these issues better, explore our WordPress Website Issues Complete Guide. For local business owners seeking regional expertise, consulting specialized agencies such as those offering WordPress Support Santa Rosa, CA – 702 Pros can provide valuable localized support.
Below is a comparison table outlining the key differences between the three most common types of website failures:
| Issue Type | Primary Cause | Typical Symptoms | Risk Level |
|---|---|---|---|
| Plugin/Theme Conflict | Incompatible code, failed updates, or mismatched PHP versions. | White Screen of Death, broken page layouts, or non-functional buttons. | Medium |
| Database Corruption | Server crashes during database writes, database overhead, or bad queries. | “Error Establishing a Database Connection” message or missing content. | High |
| Malware Infection | Weak admin passwords, outdated software, or vulnerable upload forms. | Unauthorized redirects, spam links, Google blacklist warnings. | Critical |
Common Indicators That Your Website Needs WordPress Site Repair
How do you know your site is actually broken or compromised? Sometimes the signs are subtle, but often they are glaringly obvious.
Malware infections frequently manifest as unauthorized redirects. If you attempt to visit your homepage and find yourself redirected to a suspicious third-party shopping site, your site has been compromised. Other times, hackers inject hidden spam links into your footer or blog posts, which might go unnoticed by you but will quickly be flagged by search engine crawlers.
Additionally, if Google Chrome displays a bright red “Deceptive site ahead” warning when loading your URL, your site has been blacklisted due to a security breach. Other common indicators include a sudden, unexplained drop in loading speeds, broken contact forms, or checkout failures on e-commerce platforms. If you are experiencing any of these issues, you can read more about diagnosing these problems in our guide on WordPress Woes: Unraveling the Mystery of a Broken Site.
First Steps and Safe Backup Procedures Before Repairing
Before you modify a single file or click “repair” on any database table, you must adopt a “safety-first” troubleshooting mindset. When a site goes down, panic often leads to hasty decisions – like deleting folders or running unverified database queries – which can turn a minor, easily fixable bug into permanent data loss.
Before attempting any WordPress site repair, you must secure a clean backup of your current site, even in its broken state. This ensures that if your repair attempts make the problem worse, you can easily revert to your starting point.
Whenever possible, perform your troubleshooting and repairs inside a staging environment. A staging site is an exact clone of your live website hosted on a private URL. Testing updates, deactivating plugins, and replacing core files on staging ensures that your live visitors do not see broken pages or error messages while you work.
If you are locked out of your WordPress dashboard, you will need to access your site files directly using FTP/SFTP (File Transfer Protocol) or your hosting provider’s control panel File Manager. Make sure you have your hosting login credentials handy before proceeding. For a detailed roadmap on how to handle these situations without panicking, refer to our guide, Don’t Panic and Restore Your WordPress Site with This Guide.
How to Safely Back Up Your Files and Database
If you still have access to your hosting control panel (such as cPanel, Plesk, or a custom host dashboard), you can easily generate a full backup. If you must back up your site manually, follow these two essential steps:
1. Back Up Your Files
Connect to your server via SFTP or open your hosting File Manager. Navigate to the root directory of your WordPress installation (usually named public_html, www, or htdocs). Download the entire directory to your local computer. If you have limited bandwidth, prioritize downloading the wp-content folder, as this contains all your uploaded media, themes, and plugins. The WordPress core files can always be downloaded fresh from WordPress.org, but your wp-content folder is completely unique and irreplaceable.
2. Back Up Your Database
Log into your hosting account and navigate to phpMyAdmin. Select your website database from the left-hand sidebar. Click on the Export tab at the top of the screen. Keep the export method set to “Quick” and the format set to “SQL”, then click the Go button. This will download a .sql file containing all your posts, pages, user accounts, and plugin settings.
Store both your file backup and your database export in a secure cloud storage location. For a comprehensive look at backup and recovery strategies, check out The Ultimate Guide to Restoring Your WordPress Website from Backup.
Step-by-Step Guide to WordPress Site Repair
Once your backups are safely stored, you can begin the physical repair process. Systematic troubleshooting is the key to resolving WordPress errors without introducing new ones.
If your site files have been corrupted by a failed automatic update or a malware attack, you may need to perform a manual core file replacement. This process replaces your core WordPress files with clean, uncorrupted versions while leaving your content completely intact.
- Download the latest version of WordPress from the official WordPress.org website and extract the ZIP file on your computer.
- Connect to your server using SFTP.
- Delete the existing
wp-adminandwp-includesfolders on your server. Do not delete thewp-contentfolder or yourwp-config.phpfile. - Upload the fresh
wp-adminandwp-includesfolders from your extracted ZIP file to your server. - Upload the individual files from the root of the extracted ZIP folder (such as
index.php,wp-login.php, etc.) to your server, overwriting the existing files.
Additionally, check your file permissions. Incorrect file permissions can block WordPress from reading or writing files, leading to errors. Standard WordPress security practices dictate that all directories should be set to 755 and all files should be set to 644, with the exception of wp-config.php, which can be hardened to 400 or 440 depending on your host. For more detail, read our Fix WordPress Website Complete Guide.
Diagnosing and Fixing Plugin and Theme Conflicts
If your site broke immediately after an update, a plugin or theme conflict is almost certainly the cause. If you still have access to your admin dashboard, you can deactivate your plugins one by one until the site functions normally again.
If you are locked out of your dashboard, you can disable your plugins manually using SFTP:
- Connect to your server and navigate to the
/wp-content/directory. - Locate the folder named
plugins. - Rename this folder to something like
plugins_old. This action instantly deactivates every plugin on your site, allowing you to regain access to your admin dashboard. - Once you are back in, rename the folder back to
plugins. Your plugins will remain deactivated inside the dashboard, allowing you to reactivate them one by one to find the culprit.
To test for theme conflicts, switch your active theme to a default WordPress theme (such as Twenty Twenty-Four). If you cannot access the dashboard to do this, navigate to /wp-content/themes/ via SFTP and rename your active theme’s folder. WordPress will automatically fall back to an active default theme if it cannot find your primary theme files.
To pinpoint the exact line of code causing the crash, enable WordPress debug mode. Open your wp-config.php file and locate the line that says:
define('WP_DEBUG', false);
Change this to:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
This configuration will prevent errors from displaying on your public-facing site while writing all PHP errors to a file named debug.log inside your /wp-content/ directory. You can read more about resolving these conflicts in our guide on how to Fix Broken WordPress.
Resolving the White Screen of Death and 500 Internal Server Errors
The dreaded “White Screen of Death” (WSoD) occurs when a PHP fatal error occurs but your server settings prevent the error from being displayed on screen, resulting in a blank white page. Similarly, a 500 Internal Server Error indicates a general server-side issue, often caused by a resource exhaustion or a misconfigured configuration file.
To resolve these errors, try the following solutions:
Increase the PHP Memory Limit: Open your
wp-config.phpfile and add the following line of code just before the line that says “That’s all, stop editing! Happy publishing”:define('WP_MEMORY_LIMIT', '256M');Regenerate your
.htaccessFile: A corrupted.htaccessfile is a common cause of 500 errors. Connect to your server via SFTP, locate the.htaccessfile in your root directory, and rename it to.htaccess_old. Try reloading your site. If it works, log into your dashboard, navigate to Settings > Permalinks, and click Save Changes to automatically generate a fresh, clean.htaccessfile.- Check Server Error Logs: If the steps above do not work, log into your hosting control panel and review the server error logs. These logs record every failed request and can tell you exactly which file or script caused the server to fail.
For a deeper dive into these specific errors, consult The Ultimate Guide to Fixing Your WordPress White Screen Woes and our WordPress 500 Internal Server Error Fix documentation.
Repairing Corrupted Databases and Connection Errors
An “Error Establishing a Database Connection” message means that WordPress is unable to communicate with your MySQL database. This can happen if your database credentials have changed, if your database server is down, or if your database tables have become corrupted.
First, verify your database credentials. Open your wp-config.php file and check that the database name (DB_NAME), database user (DB_USER), database password (DB_PASSWORD), and database host (DB_HOST) match the credentials listed in your hosting control panel.
If the credentials are correct but your database is corrupted, you can use the built-in WordPress database repair tool. Add the following line to your wp-config.php file:
define('WP_ALLOW_REPAIR', true);
Once saved, open your browser and navigate to yourwebsite.com/wp-admin/maint/repair.php. Click the Repair Database button. Once the repair process is complete, make sure to remove that line of code from your wp-config.php file to prevent unauthorized users from running database repairs.
Alternatively, you can repair your tables directly inside phpMyAdmin by selecting all tables, clicking the dropdown menu at the bottom of the list, and selecting Repair table. For further assistance, check out our WordPress Errors Fix Best Tips.
Cleaning Malware and Optimizing Site Performance
Malware infections can destroy your search engine rankings and compromise sensitive user data. If your site has been hacked, you must act quickly to clean the infected files and secure your environment.
Once your site is clean, optimizing performance is crucial. Slow-loading websites frustrate users and perform poorly in search results. Implementing server-side caching, compressing images, and integrating a Content Delivery Network (CDN) can dramatically improve your page load speeds.
For local businesses in the North Bay, utilizing specialized regional hosting providers can make a major difference. Seeking services like WordPress Hosting & Maintenance – Bright House Media can help ensure your site is hosted on optimized, secure servers. Additionally, if you need professional aesthetic updates alongside performance improvements, consulting experts in WordPress web design in Santa Rosa, CA – FreshySites can help align your speed optimization goals with a modern, responsive layout.
How to Recover from a Malware Infection
If you suspect your site has been infected with malware, follow this systematic cleanup checklist:
- Run a Comprehensive Security Scan: Use a trusted security plugin like Wordfence or Sucuri to scan your entire directory for malicious code, modified core files, and suspicious database entries.
- Replace Core Files and Themes: Download fresh copies of WordPress core, your themes, and your plugins. Delete the old directories and replace them with the clean files to ensure no malicious backdoors remain.
- Reset All Passwords: Change the passwords for every WordPress admin account, FTP account, hosting database user, and hosting control panel account. Use strong, randomly generated passwords.
- Clean the Database: Scan your database for malicious scripts, unauthorized admin users, or suspicious iframe injections.
- Implement Security Hardening: Install a web application firewall (WAF), enable two-factor authentication (2FA) for admin logins, and disable file editing inside the WordPress dashboard.
For a complete step-by-step walkthrough, refer to our WordPress Site Recovery Complete Guide.
Frequently Asked Questions about WordPress Site Repair
How do I fix a WordPress site stuck in maintenance mode?
When you run updates, WordPress temporarily creates a file named .maintenance in your site’s root directory to show visitors a maintenance screen. If your server times out or your internet connection drops during the update, WordPress may fail to delete this file, leaving your site permanently stuck in maintenance mode.
To fix this, connect to your server via SFTP or open your hosting File Manager. Navigate to your root directory, find the file named .maintenance, and delete it. Refresh your website, and it should load normally.
What should I do if my pages are showing 404 errors?
If your homepage loads fine but all your inner pages display a “404 Not Found” error, your permalink structure has likely been broken or your .htaccess file has been deleted.
To fix this, log into your admin dashboard, navigate to Settings > Permalinks, and simply click the Save Changes button at the bottom of the page. This action forces WordPress to flush its rewrite rules and regenerate your .htaccess file. If you cannot access your dashboard, check out our guide on How to Fix 404 Error in WordPress.
When to Hire a Professional for WordPress Site Repair
While many minor issues can be resolved with a bit of troubleshooting, certain scenarios require professional intervention. You should seek expert help if:
- Your database is severely corrupted, and you are missing critical content or customer orders.
- Your site has a persistent malware infection that keeps returning after multiple cleanups.
- You are uncomfortable using SFTP, editing PHP code, or managing database tables.
- Your business is losing money every hour your site is offline, and you need an immediate, guaranteed fix.
Working with a dedicated support service ensures that your site is repaired safely without risking further data loss. Learn more about how a professional team can help by reading Your Site is Broken and a Troubleshooting Service is the Hero You Need.
Conclusion
A broken WordPress website can be incredibly stressful, but with a systematic approach and proper backups, almost any issue can be resolved. Regular maintenance – including testing updates on staging sites, keeping plugins updated, and monitoring security – is the best way to prevent future downtime and protect your online presence.
If you don’t have the time to manage technical updates, or if you are currently facing a complex website emergency, we are here to help. At wpOncall, we specialize in comprehensive WordPress security, emergency repairs, and ongoing support. Our experienced team of engineers is available 24/7 to keep your website fast, secure, and running smoothly.
Let us handle the technical details so you can focus on running your business. Visit our wpOncall WordPress Customer Care page today to learn more about our support plans and get your website back on track.