One of the great things about WordPress is how most of the time “it just works.” But most of the time doesn’t mean all of the time. And if you use WordPress, you’ll eventually run into one of the common WordPress errors that make you want to scream at your laptop.
I’m talking about the things where you go to access your site only to be met with…something else. It could be the ominous-sounding white screen of death, the classic Error Establishing a Database Connection, the dreaded Parse Error, or any one of the other common WordPress errors.
In this post, I’ll not only share a little bit more about these errors, I’ll also tell you how you can go about diagnosing and fixing each specific WordPress error.
The only true technical skills that you’ll need are an FTP program (plus an understanding of how to use it) and the know-how to make some super simple edits to your wp-config.php file.
By the end of this article, here’s what you’ll be able to fix:
- Error Establishing a Database Connection
- White Screen of Death
- Parse Error / Syntax Error
- 500 Internal Server Error
- Stuck in Maintenance Mode
If possible, you should always try to make a backup of your site before starting so you don’t mess things up even more!
Ready? Let’s go!
Step 1: How to Deactivate Plugins and Themes If You Can’t Access YourWordPress Dashboard
One common diagnostic technique that applies to most common WordPress errors is to deactivate your plugins and/or themes to diagnose a potential issue.
If you can still access your WordPress dashboard, you can do that just like normal.
Oftentimes you’ll be completely locked out of your dashboard. So how can you deactivate plugins and themes if you’re locked out of your dashboard?
Easy – just connect to your site via FTP and navigate to the …/wp-content/ folder:
Then, navigate to either the plugins or themes subfolder.
To deactivate a plugin or theme, all you need to do is rename its folder. I like to append “_old” to the end of the folder name so it’s easy to switch back later on. You can also rename the parent plugins folder to deactivate all your plugins at once.
For example, to deactivate Jetpack, you would just right click on the folder and choose Rename to edit the folder name:
I’m using the free FileZilla FTP program if you want to be able to directly follow my screenshots.
To make the plugin or theme work again, all you need to do is go back and remove the “_old” part.
Easy enough, right? You’ll be using this technique quite a bit, which is why I wanted to explain the whole thing once at the beginning.
How to Fix Error Establishing a Database Connection Message
The Error Establishing a Database Connection is impossible to misdiagnosis. That is, you’ll see the message loud and clear when you visit your site:
Because your database is where all of the information for your WordPress site is actually stored (post content, usernames, etc.), WordPress always needs access to the database in order to function.
This message is what you get when WordPress is having trouble connecting to your database for a reason like:
- A corrupt database
- Incorrect database login credentials
- Hosting issues
While I can’t help you with the third one (you’ll need to talk to your host for that), I can help you diagnose and fix the first two issues.
How to Fix a Corrupt WordPress Database
The easiest way to check for a corrupt database is to try and access your WordPress dashboard. If you can access your dashboard but not the front-end of your site, the most likely cause is a corrupt database.
To fix it, you’ll need to enable the database repair utility in your wp-config.php file and then run the built-in tool.
First up, use your FTP program to edit your wp-config.php file in the root directory of your site:
Add this line to the bottom of your wp-config.php file and save it:
Then, go to “yoursite.com/wp-admin/maint/repair.php”. Make sure to replace “yoursite.com” with your actual domain name.
All you need to do is click the Repair Database button and WordPress will handle the rest:
Once the repair process finishes, your site should work. Just make sure to go back and remove the line of code that you added to your wp-config.php file.
How to Fix Incorrect Database Login Credentials
If you see the Error Establishing a Database Connection message when you try to access both your dashboard and the front-end of your site, the next potential culprit is incorrect database credentials.
You should see a message like this when you try to access your dashboard:
While it’s possible that you’re getting that message because issues with your host, you might have also accidentally put in the wrong database credentials.
While there are ways to diagnose if your database credentials are working, I think the easiest way is to just create a new set of credentials. That way, you can be totally sure there aren’t any issues (and it takes less time than trying to diagnose the issue, anyway).
To do that, go to Plesk or cPanel and select the MySQL Databases option.
From there, you’ll need to create a new database user. Then, add that database user to your WordPress site’s database with All Privileges.
Finally, go to your wp-config.php file and update the values for DB_USER and DB_PASSWORD to reflect the database user that you just created:
If the issue still isn’t fixed, you should contact your host and see if there’s an issue with the database server.
How to Fix WordPress White Screen of Death
The WordPress white screen of death is basically any time your site looks like this:
Yup! There’s nothing there – just an empty white screen.
This WordPress error can be a pain to fix because there are a number of possible issues. For that reason, your best bet is to use the process of elimination to run through the following checklist.
Disable Plugins and Return to Default Theme
Try disabling all of your plugins and returning to the default theme (remember – I told you how to do this at the beginning).
If your site magically starts working, reactivate your plugins and themes one by one to isolate the problem.
Increase Your Site’s Memory Limit
If it’s not a plugin or theme issue, you might be able to fix the issue by increasing your site’s memory limit.
To do that, go to your wp-config.php file and find a line of code that looks something like this:
define( 'WP_MEMORY_LIMIT', '128M' );
You might see a different number. Or, sometimes you might not even have this line.
If you already have the line, change the number to 256. If you don’t have the line of code already, you can just add this to your wp-config.php file:
define( 'WP_MEMORY_LIMIT', '256M' );
Some hosts put their own cap on memory usage, so you might need to talk to your host as well.
How to Fix Parse Error / Syntax Error
If you like to tinker with custom code snippets, you’ll probably run into a syntax error at one point or another.
This issue usually crops up when you add a code snippet to functions.php and forget something small like a comma or bracket.
Thankfully, it’s easy to fix because the error tells you exactly where the problem is:
Like I said, the issue is usually in your functions.php file. Just connect to your site, edit the file, and fix the offending line of code by either removing the whole snippet or, if you feel up to it, actually fixing the syntax error itself.
How to Fix 500 Internal Server Error
500 Internal Server Error, also sometimes just Internal Server Error, is usually the result of a corrupt .htaccess file, though it can also stem from plugin, theme, or memory limit issues.
Here are some solutions to fix the problem.
Generate a New .htaccess File
Connect to your site via FTP and find the .htaccess file in the root folder of your site. Rename it to something like .htaccess_old:
If that fixes the problem, you’ll still need to generate a new, uncorrupt .htaccess file. To do that, go to Settings → Permalinks and click the Save button to force WordPress to generate a new .htaccess file for your site:
Deactivate Plugins and Themes
If your .htaccess file isn’t the issue, your next step is to deactivate your plugins and return to the default theme.
If that fixes the problem, reactivate your plugins and theme one by one to isolate the problem.
Increase WordPress Memory Limit
Still no luck? You can see if increasing your site’s PHP memory limit fixes the issue. To do that, edit your wp-config.php file and look for a line of code that looks like this:
define( 'WP_MEMORY_LIMIT', '64M' );
Change the number to 256M. Or, if you don’t see that line of code, just add a new line like this:
define( 'WP_MEMORY_LIMIT', '256M' );
Sometimes your host puts a maximum memory limit that you can’t bypass, so it’s also worth chatting to your hosting support about increasing your site’s memory limit.
Reupload wp-admin and wp-includes Folders
Nothing’s worked yet? Bummer! You can still try one more thing. Download a fresh WordPress install from WordPress.org. Extract the ZIP file and upload the wp-admin and wp-includes folders to your site via FTP.
Make sure to choose the Overwrite option when your FTP program asks you what to do with identical files:
Don’t worry – this won’t affect your site or content.
How to Fix Stuck in Maintenance Mode
Whenever you run an automatic update through WordPress, WordPress puts your site into maintenance mode for the duration.
Most of the time, this goes off without a hitch. But sometimes, your site gets stuck in a perpetual state of maintenance mode…which isn’t so good.
Thankfully, this one is easy to fix.
All you need to do is connect to your site via FTP and delete the .maintenance file in the root folder of your site:
Your site should start working normally as soon as you delete the file.
Take Care of These Common WordPress Errors for Good
While this isn’t a full list of WordPress errors, these are some of the most common WordPress errors that you’re likely to run into on a day-to-day basis.
I hope this article saved you some frustration and helped get your site back to a functioning state. And if you have any questions, please leave a comment and I’ll try to help out.