7 Common WordPress Errors and How to Fix Them

Keyboard with orange button that says oops

WordPress is a great piece of software that works fine most of the time. But there are times when things stop working. Maybe WordPress can’t connect to the database. Or maybe some files have been corrupted. Whatever the case may be, here are 7 of the most commonly encountered WordPress errors and how you can fix them:

A Word of Warning: Backup Your Website

Before you go on and follow any of the steps below, make a backup of your whole website. When trying to fix your website, you might break it even more. Having a backup ensures you can always revert back to the “less-broken” state of your website. So, before you make any changes to your website, back it up.

Error Establishing a Database Connection

This is the most common error WordPress users face. If you are a WordPress user, you will probably face this error at least a hundred times in your lifetime.
When you see the error message “Error Establishing a Database Connection,” it simply means that WordPress couldn’t connect to your MySQL database server.

The most common reason for this problem is incorrect database login credentials. Maybe your password or the username is wrong.
To check if your password and username are right, edit your wp-config.php file and look for the following code:

define('DB_NAME', 'database_name’);
/** MySQL database username */
define('DB_USER', 'username');

/** MySQL database password */
define('DB_PASSWORD', 'password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

In the above code sample:

  • username is the username of the MySQL database user that has access to your WordPress database.
  • password is the password of the MySQL database user.
  • host is the address of the server that is hosting your database. Here’s a list of common MySQL hostnames.
  • database_name is the name of your WordPress database you are trying to access.

Check the database login credentials in your wp-config.php file and fix them if they are wrong. In most cases, this error shows up when the database login credentials are invalid.

But there are times when other things might be causing this error. One of those is that your database server isn’t responding. In that case, all you can do is contact your web host and ask them to fix the problem.

500 Internal Server Error

This error shows up when there was some sort of an error on the server but the server software wasn’t able to identify the exact error.

There are literally millions of reasons why you might be seeing this error. Maybe you installed a broken plugin or made some changes to the WordPress codebase.

Here are a few things you should try:

  1. Check Your .htaccess File
    The .htaccess file is used to rewrite URLs and make them look pretty. The “pretty permalinks” option in the WordPress permalinks settings uses this file to make the URLs of your website look “pretty.”
    If your .htaccess file has been corrupted, your server will display the 500 internal server error.
    To know if your .htaccess file is creating the problem, you need to log into your FTP client or the File Manager app your web host provided and rename the .htaccess file to “.htaccess_backup”
    Once you rename the file, try opening the homepage of your website. If your website is now working, visit the permalinks settings page from your WordPress dashboard and click Save Changes.
  2. Switch To The Default Theme
    If you are seeing the 500 Internal Server Error message, then you probably can’t access the dashboard.
    If you can access the dashboard, visit the Themes section and change the theme to the default one that comes with WordPress.
    If you can’t access the dashboard or if you don’t have the default theme installed, login to your FTP client, navigate to the wp-themes folder, and rename the folder of your current theme to something else.
    This will force WordPress to switch to the default theme and in case you don’t already have the default theme, WordPress will download the default theme and install it.
  3. Increase Memory Limit
    This is rarely the cause for the 500 Internal Server Error but sometimes your WordPress site can go over the default PHP Memory Limit set in the wp-config.php file. When this happens, you see the 500 Internal Server Error.
    To fix this, login to your FTP client and add the following line of code to the end of your wp-config.php file:
    define(‘WP_MEMORY_LIMIT’, ’64M’);
  4. Deactivate All Your WordPress Plugins
    A corrupt or broken plugin might be the reason why you are seeing this error.
    If you don’t know which plugin is causing this problem, you will have to deactivate all your WordPress plugins.
    In most cases, if you are seeing this error, you won’t be able to access the WordPress dashboard. If you are able to access the Plugins page from your WordPress dashboard, disable all the plugins from there.
    On the other hand, if you can’t access the Admin area, login to your FTP client, and rename the plugins folder in wp-content folder.
    This will disable all the active plugins.

White Screen of Death

This is the most dreaded error in the WordPress community because you don’t see an error message telling you why you are seeing this white screen.

Here are a few things you can try:

  1. Enable Debugging
    When you enable debugging in WordPress, WordPress will start displaying error messages that it would hide in a production environment. The reason why WordPress hides these error messages is because a hacker might misuse the information these errors offer.
    Once you enable debugging, you might see the real error.
    To enable debugging, look for the following line of code in your wp-config.php file:
    define(‘WP_DEBUG’, false);
    You will find this somewhere at the bottom of the file. Change false to true to enable debugging.
  2. Use The Default Theme
    If you are able to access the Dashboard, switch to the default theme. This is usually caused by broken themes.
    If you can’t access the Admin Dashboard, try the steps in the “500 Internal Server Error” section above.
  3. Disable All Plugins
    Plugins that try to alter the look of your website or your website’s Dashboard might cause this error.
    Disable all your plugins by following the instructions in the section above.
  4. Increase Memory Limit
    This is usually not the reason but try increasing the memory limit by following the instructions in the section above.

WordPress Sidebar Below Content

If your sidebar is showing up below your content instead the left or the right side (depending on your theme), then it can mean one of two things: either your theme has been corrupted or your html is invalid.

If your theme is corrupted, the best thing you can do is update the theme if an update is available or reinstall the latest version of the theme.

However, if the HTML code on your website is corrupted then you will have to fix the invalid code. This usually happens when you haven’t closed a <div>tag with a closing</div> tag.

To find out if this is really the case, open the webpage where you see this error, right click and click the “View Source Code” option.

It will show all the HTML code that your webpage is using. Copy this code, open this HTML Validation Checker tool, and paste the code in there to check if your HTML is valid.

If you see an error on that page, you will have to look for the file that has the invalid HTML code and fix the code in it. Unfortunately, every theme is different and has hundreds of files. You will have to look for the file and then look for the error causing invalid code by yourself. We cannot help you with that.

If your HTML code is valid and you are still seeing this error, your theme might be corrupted. Or your style.css file in the current theme might have some broken code. If the style.css file is broken, you will have to hire a developer to fix it.

Connection Timed Out

This error usually shows up when WordPress doesn’t have enough memory to play with. When this is the case, you will have to increase the memory limit in your wp-config.php file. To do this, place the following line of code at the end of your wp-config.php file:

define('WP_MEMORY_LIMIT', '64M');

If this doesn’t fix your error, try deactivating all the plugins and switching to the default theme. See instructions in the 500 Internal Server Error section above.

Forgot Admin Password

We are all guilty of forgetting the Admin password for our websites. Not just once but more than a thousand times. If this is happening to you, don’t panic.
It is really easy to reset the Admin password.

The easiest way to do it is through the Forgot Your Password link on the Login Page of your WordPress admin area.
If the Forgot Your Password feature offered by WordPress doesn’t work for you, login to PHPMyAdmin and select your WordPress site’s database:

Selecting the database in phpMyAdmin, an easy WordPress website fix.

Now, select the wp_users table from the list of tables:

Select wp_users, an easy WordPress website fix.

You will see all the users there are on your WordPress website (including You) as a database entry. Find your username among the list and click the Edit link to the left of the entry row:

Select edit, an easy WordPress website fix.

On the Edit page, you will see options to edit user_pass:

Change password, an easy WordPress website fix.

Just like in the above screenshot, select MD5 from the drop down and then input your new password in the value field.
Click the GO button at the bottom and login using your new password.

Pages And Posts Return a 404 Not Found Error

Your .htaccess file usually is the cause of this error. If you are seeing the 404 error on Posts and Pages, this means two things: you are probably using Pretty Permalinks and WordPress wasn’t able to edit the .htaccess file when you saved the settings.

In 99% of the cases, this problem goes away by simply clicking the Save Changes button on the Permalinks Settings page on your WordPress Admin dashboard. This will force WordPress to rewrite the new changes to the .htaccess file.

If that didn’t work, you will have to edit your .htaccess file and place the following code in it:


# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

The above code should make it work.

Stuck In Maintenance Mode After Update

This is a rare problem. If WordPress is going through the update process and for some reason is interrupted in the middle of it, you will see the Maintenance Mode message all the time on your website.

If this is the problem you are facing, simply delete the .maintenance file from your WordPress installation directory and visit your website. It fixes the problem most of the time.

Conclusion

We hope the above solutions worked for you. If they didn’t, you will have to find a web developer who can fix these errors.

If you’re looking for a managed WordPress hosting company with experience fixing common WordPress issues for you, then we hope you consider Pressable.

Zach Wiesman

Zach brings a wealth of knowledge to Pressable with more than 12 years of experience in the WordPress world. His journey in WordPress began with creating and maintaining client websites, fostering a deep understanding of the intricacies and challenges of WordPress. Later, his knack for problem-solving and commitment to service led him to pursue a role at Automattic, where he excelled in providing customer support for WooCommerce. His expertise extends beyond technical proficiency to encompass a deep understanding of the WordPress community and its needs. Outside of work, Zach enjoys spending time with his family, playing and watching sports, and working on projects around the house.

Related blog articles