Common WordPress Errors And How To Fix It

From time to time, your website will face various types of errors. There are many things that cause all these common WordPress errors. For example, incompatibility plugins/themes update, mistyping of code snippets, and many more.

So in this article, I have compiled common WordPress errors, the causes and the solutions to fix it. Please don't forget to bookmark this page as I will keep adding more info in the future. You can also click on the Table of Contents to jump straight to the error and solution you looking for.

As a precaution, before you start making any changes, don't forget to create a backup for your site. Because, in any worst case, you can revert back to the previous state.

Error Establishing A Database Connection

Cause

As the title suggested, this error is caused by the failure to establish a connection to the database. Because your database is an essential part of your site which keeps all your contents, for instance, posts and pages.

Without a connection to the database, your WordPress site cannot operate. Please take a look at the image below.

Common WordPress Errors And How To Fix It
Error establishing a database connection error.

Solution

There are few ways to fix this error depending on circumstances. And you may want to check first which of below solution suit for you.

Check wp-config.php

Before you do anything, first please check whether you can still access your website's backside by going to yoursite.com/wp-admin/. If you can't and see an error like "One or more database tables are unavailable. The database may need to be repaired". Then, please go to the next solution, otherwise, continue reading.

Most of the time, this error is caused by faulty credentials in your wp-config.php. This is most likely because it is modified by attackers, for example, through the back door of an unsafe plugin.

For your information, this file stores configuration setting for your website including your database name, username, password, and server. You can find wp-config.php in the root directory of your WordPress installation.

First, open up your hosting control panel and click on your File Manager. Next, navigate to your root directory and find wp-config.php. Then, find your database credential which should look similar like below snippet. And check whether the value is exactly the same as during your WordPress installation.

Access /wp-admin/

If you no longer can access your website's backside and it shows an error that requires you to repair your database. Then, most likely one or more of your database tables are corrupted and need to be repaired.

To do this, first, open your File Manager on your cPanel and navigate to your root directory. Next, find wp-config.php file and add the following line before "/* That’s all, stop editing! Happy blogging. */" line.

Then, go to http://www.yoursite.com/wp-admin/maint/repair.php and you will see a page similar to the image below.

Common WordPress Errors And How To Fix It
WordPress repair database page.

Click on "Repair Database" button to start repairing your database. Additionally, you can also repair and optimize your database by clicking the other button. After you finish repairing your database, don't forget to remove above line from your wp-config.php. Otherwise, other people will be able to access this function as well.

Contact Your Hosting Company

In addition to the above solutions, this error may also come from your hosting provider due to various reasons.

For instance, this error occurs when your website suddenly hit by heavy traffic and your server cannot handle the load. This may happen especially to shared hosting plan with limited server resource. You can wait a while and try refreshing your browser to see if this error disappears.

Beside that, this error may occur when your database user no longer has sufficient permission. It may have been modified or removed for various unknown reasons. This error could also happen when your database has reached the maximum size limit set by your hosting provider.

Both of the situations above have happened to several of my client's website. In any case, you need to contact your hosting provider and check whether your website database is responsive.

White Screen Of Death

Cause

White Screen of Death (WSOD) is one of the common WordPress errors. If you've ever experienced Blue Screen of Death (BSOD) on Windows, then you may be familiar with this one. Unlike Blue Screen of Death, this error occurs on your web browser.

However, please note that this error may look slightly different depending on the type of your web browser. Please take a look at the images below.

Common WordPress Errors And How To Fix It
WordPress White Screen of Death error on Google Chrome.
Common WordPress Errors And How To Fix It
WordPress White Screen of Death error on Mozilla Firefox.

Generally, this error occurs when you have reached your memory limit. This could be caused by poorly coded theme/plugin, or a plugin/theme you are using suddenly stop functioning properly. There is also a possibility that there's an issue with your web hosting server.

Solution

Considering that this error can be caused by many things, it may need a few troubleshooting to fix it. In order to determine which is the real cause for this error, first, check all other websites that sharing the same server with you. You can do this by entering your domain name on this tool.

If all of the websites are having the same error, most likely, your server currently having some sort of issue. I would strongly encourage you to contact your hosting company for further support. Otherwise, if this error only appears on your website, then let's go through to the solutions below.

Increase PHP Memory Limit

A common solution to fix this error is by increasing PHP memory limit. PHP memory limit is the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written plugins or theme from eating up all available memory on a server.

All you need to do is by going to your hosting cPanel and open your File Manager. Next, open your wp-config.php file and find the constant similar like the following line.

Once you find the constant above, change its value to 256M or more as you need and save it. If you can't find the constants above, then paste the above constant before "/* That’s all, stop editing! Happy blogging. */" line and save your file.

By default, WordPress has set 128M as the maximum memory limit. However, this value may vary depending on the default value set by the hosting company.

While you can add maximum memory as allowed on your hosting plan. Yet, it is wise to stick to the golden rule. In which only gives PHP what PHP needs to work, and nothing more.

Disabling All Plugins

If increasing PHP memory limit doesn't resolve this error, the next thing you can do is disable all your plugins. Especially if this error only occurs in some part of your website, for example, on a certain post or page.

It's most probably that your plugins are poorly coded, have been infected by malware or modified by an unauthorized party. Simply deactivate all your plugins. If this fixes this error, then, please activate your plugins back one by one to find the culprit.

Switch Back To The Default Theme

Similarly, you can also try revert back to a default theme by switching to any of official theme made by WordPress.org. Just download any of this theme and activate it to see whether it fix your issue. If it does, then I would suggest you contact your theme developer and notify them regarding this issue.

Reinstall WordPress Core Files

If none of the solutions above works, then perhaps you need to reinstall WordPress core files. In a very rare case, it's also possible that these files have been corrupted or modified by an irresponsible party. You might want to read how to reinstall WordPress core files.

Other Fixes

In case that you have found your problem cause, you can try to dig deeper by turning on debug mode. In which, you can get more details about your error. You can read how to debug in WordPress as well as other related information in this article.

Briefly Unavailable For Scheduled Maintenance

Cause

This error typically occurs when you are running update for your site. During an update, WordPress will put your site in maintenance mode and will show a notice to your visitors. This is to inform them to come back later as you can see in the image below.

Common WordPress Errors And How To Fix It
Briefly unavailable for scheduled maintenance error.

However, in some rare case when the update is interrupted during the process, the maintenance mode doesn’t go away. And in the worst case, it also locked you out of the admin area.

Solution

Fortunately, the solution for this error is pretty straightforward. Simply log in to your hosting control panel and open up your File Manager. Next, navigate to your root directory and delete the file called .maintenance. Please note that this is a hidden file so you might need to check the "Show Hidden Files (dotfiles)" box to see it.

Alternatively, you can also access your root directory via FTP client and delete it. You may want to read how to delete, upload or download files and folders using FTP client.

Internal Server Error

Cause

Internal Server error is also one of the common WordPress errors. This error occur when something went wrong but your server is unable to identify the problem. Please keep in mind that this error may look slightly different but this is how it looks on our side.

Common WordPress Errors And How To Fix It
500 - Internal server error.

Solution

There are many reasons that can cause an internal server error. For instance, corrupted .htaccess, insufficient memory, poorly coded plugins, infected WordPress core files and many more.

But since there is no indication on this error which points out its cause, all you can do is try each one of the solutions below.

Checking .htaccess

The first thing to do when you encounter this error is to check your .htaccess file. This error primarily occurs due to the corrupted .htaccess file.

First, log in to your hosting control panel and open your File Manager. Please keep in mind that .htaccess is a hidden file. So, you might need to check the "Show Hidden Files (dotfiles)" box in order to see it. Next, rename your .htaccess file to something like .htaccess_old.

Once you rename your .htaccess file, please clear your cache and try to visit your website. If this fixes your problem, please go to Settings » Permalinks and click on save button without making any changes. This will generate a new .htaccess file for your website.

Otherwise, if your issue still hasn't resolved, don't forget to rename your .htaccess_old back to .htaccess.

Increase PHP Memory Limit

Sometimes, this error can also happen when you have insufficient memory. You can fix this by increasing PHP memory limit. In case you didn’t know, it is the maximum amount of memory in bytes allowed to be used by any script during its execution.

This can be done by login to your hosting cPanel and open up your File Manager. After that, open your wp-config.php located in the root directory and find the constant similar to the following line.

After you find the constant above, please change its value to 256M or more and save it. If in case you can't find it, simply paste the above constant just before "/* That’s all, stop editing! Happy blogging. */" line and save your file.

While your hosting provider probably allows you to set a higher limit of memory but I wouldn't recommend it. Since it is wise to stick to the golden rule which only gives PHP what PHP needs to work, and nothing more.

Disabling All Plugins

Besides both of solution above, you can also try deactivating all your plugins. There's a possibility that your plugins might have a compatibility issue, infected by malware or modified by an attacker.

Since there is no easy way to know, what you can do is deactivate all your plugins. If this error disappears, then, reactivate it one by one to find the plugin that causes this error. Once you find it, don't forget to notify the plugin author by opening a support ticket to the related plugin.

Reinstall WordPress Core Files

Another solution you can try is by reinstalling your WordPress core files. Similar to plugins, there are also chances that your WordPress core files have been corrupted or infected by malware. You might be interested in how to reinstall WordPress core files.

Contact Your Hosting Provider

If none of the solution above work for you, then I strongly recommend you to contact your hosting support team. They certainly can help you by checking on server log and assist you further regarding this error.

Parse Or Syntax Error

Cause

Another common WordPress errors especially for developers or casual tweakers. This error usually occurs when adding code snippets on your theme functions.php or site-custom plugin.

There are numbers of reasons that cause this error. However, most of the time, it always indicate why and where this error comes from. For example, our syntax error is caused by missing semicolon in our theme functions.php on line 6. Please refer to the image below.

Common WordPress Errors And How To Fix It
Parse error.

Solution

The solution to this error is different depending on what it causes. Some may have no semicolon at the end of the line, missing $ on the variable and many more. However, all in all, it basically just needs you to fix your code.

If you are unsure how to fix your code snippets, then I suggest you remove the affected part of your snippets for the time being. And get help from a professional developer afterward. Likewise, you can also join developers community such as StackOverflow or WordPress StackExchange for support.

Cannot Modify Header Information - Headers Already Sent

Cause

This is another common WordPress errors that typically occurs to developers. If you receive this warning, it usually means that you have spaces or characters before PHP opening tags or after PHP closing tags.

Solution

Fortunately, this error is extremely easy to fix. Simply open the affected file indicated in the error using any text editor such as Notepad, Notepad++, Sublime or other. Then, remove any spaces or characters before opening PHP tags and after closing PHP tags.

Let's take a look at the example below. Where there are abc characters before the <?php opening tag and def after the ?> closing tag. Just remove the abc and def characters and save the file to fix this error.

Pages And Posts Return A 404 Not Found Error

Cause

If you are seeing a 404 not found error when visiting existing post or page, don't worry. Because generally, this error appears because of misconfiguration of your .htaccess file. The solution for it is very easy and can be fixed in a few minutes.

Solution

The easiest way to fix this error is by re-save your permalink structure. First, log in to your WordPress admin and go to Settings » Permalinks. Then, click on the Save button without doing any change. This will force WordPress to flushes and rewrite your permalink in the htaccess file.

In 9 out of 10 cases, this error will disappear simply by re-saving your permalink structure. However, if the above method didn't work for you, then you have to manually enter the code into your htaccess.

To do this, first, login to your cPanel and open your File Manager app. Then, find and open your .htaccess file which usually located in the root of the domain. Please note that .htaccess is a hidden file so you might need to check the "Show Hidden Files (dotfiles)" box to view this file.

Next, copy and paste the following snippet into your .htaccess file and save it. Finally, clear all your cache and re-visit your website. Your error should have gone.

Forgot Admin Password

Cause

Yes, it happens to the best of us. No joke. This happens when you use a very strong password (which is good) that is too hard to remember. Or you unable to remember where you place your password. Either way, resetting your password is the only way to regain access to your website.

Solution

To reset your WordPress admin password, first, login to your hosting panel area. Next, access your WordPress database by opening phpMyAdmin which usually located under the Database section. Please refer to the image below.

Common WordPress Errors And How To Fix It
phpMyAdmin under Database section in cPanel.

Once your phpMyAdmin interface loaded, please select the database of the website that you wish to reset the password. Next, click on the wp_users table. Please keep in mind your table prefix might be different from wp_ if you have changed it during WordPress installation. For example, our database table prefix is jebatonline_ as you can see in the image below. Then, find your username and click on the Edit to continue.

Common WordPress Errors And How To Fix It
Opening users table in the WordPress database using phpMyAdmin.

In this step, you will see a field called user_pass with a lot of random characters. Don't worry because that is the password you lost but has been encrypted with the MD5 hash for security reason. Simply delete everything in that field and replace it with your new password.

Common WordPress Errors And How To Fix It
Editing the admin password in the users table.

Next, use the drop-down menu within the same row with user_pass field and set its value to MD5. Then, scroll down to the bottom of your page, select Save and Go back to the previous page from both drop-down menus. Finally, click on the Go button to save your new encrypted password. Congratulation, you now have successfully reset the admin password of your website.

Destination Folder Already Exists

Cause

One of the most common WordPress errors. It occurs when you try to install or reinstall a WordPress theme or plugin.

If you receive an error similar to the image below during theme or plugin installation, don't worry. It indicates that a folder with the same name as a theme or plugin you wish to install already exists in the WordPress directory. Hence, WordPress abort the installation.

Common WordPress Errors And How To Fix It
Destination folder already exists error.

The reason why this happens is because of your previous installation or uninstallation was interrupted in the middle. And it left a folder (with or without content within) during the process.

Solution

To fix this error, all you have to do is login to your hosting control panel and open up your File Manager. Then, navigate to /wp-content/themes/ or /wp-content/plugins/ depending on which one gives you the error.

Next, search for the folder of the theme or plugin that you have failed to install previously. Once you find it, delete it. After that, please go back to your WordPress admin area and try reinstalling the theme or plugin. You should be able to install it without any problem as usual.

Alternatively, you can also delete the file via any FTP client. You may be interested in reading how to delete, upload or download files and folders using FTP.

WordPress Sidebar Below Content

Cause

Seeing your sidebar below your content is a truly unwanted situation. It happens when your theme is corrupted or your HTML code is invalid which breaks its layout. But if it's the latter, most probably you are missing closing DIV tag on your HTML code.

Solution

If this issue starts after you update your theme, I suggest you revert back your theme to its previous version. Otherwise, you can try to update your theme to the latest version or completely reinstall it. If this solves your issue, it could mean your theme files has been corrupted.

However, if this error still persists, its indicate that your HTML code is invalid and need fixing. This generally occur when you haven't close a <div> tag with a </div> tag. You can do this by validating your code using HTML Validation Checker tool.

There are 3 ways to validate your HTML code using this tool. It is by URL, File Upload or pasting your code into Direct Input. The easiest way is by entering the URL of the page and click on the Check button. As soon as the validation complete, you will see similar error like on the image below.

Common WordPress Errors And How To Fix It
Example report from validator.w3.org.

From this error report, you can see which DIV is missing its closing tag and start to fix it.

You Make Changes And Nothing Happens

Cause

Sometimes, after you make changes on your website, yet nothing changes after you save and refresh your browser. This is due to your web browser stores information about websites you visit. This information or known as cache allows your devices to load any websites you've visited faster than your first visit.

So, if there's nothing changed after you save your page, it means your browser believe that the change isn't significant. Therefore, it will simply load all cache stored on your device rather than load new changes you made.

Solution

Fear not, this is very easy to fix as this is common thing happen to any blogger. And to be honest, it also always happens to me.

Perform Hard Refresh

Since normal refresh hasn't shown any changes on your website, next thing you can try is performing a hard refresh. This is by forcing your browser to load the most recent version of a page. Please note that performing hard refresh is different depending on the operating system you use.

  • For Windows and Linux press Ctrl + F5 or Ctrl + Shift + R.
  • For Mac press Cmd + Shift + R.

Clear Your Cache

If hard refresh doesn't do the trick, then I would recommend you to clear your browser cache. If you are using Google Chrome or Mozilla Firefox, first, press Ctrl + Shift + Delete. Next, select "All time" on Chrome or "Everything" on Firefox. Finally, check all boxes and click "Clear data" on Chrome or "Clear Now" on Firefox to start clearing your cache.

For mobile users, please go to Settings » Privacy » Clear browsing data to clear your cache. Please keep in mind that this process may take up to a few minutes to finish.

Alternatively, you can also clear your browser cache using another program such as CCleaner or use browser incognito mode instead. Read our CCleaner Professional review.

Restart Your Devices

If both approaches above did not solve your issue, please try restarting your device. This has happened to me several times where restart my computer helps, after clearing browser cache fails to fix my issue.

Footer Note

I hope this article helps you to troubleshoot common WordPress errors you experience. If you encounter any issue or have other tips or better solutions to fix these errors, please don't hesitate to share it with us in the comment section.

  • If you think your friends would find this useful, please share it with them. It will allow us help more people.
  • To get more of our latest update, please subcribe to our newsletter.
  • You can also print this article for reference.
This article has been printed from https://www.jebatonline.com/articles/common-wordpress-errors-and-how-to-fix-it/

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.