Published by on 13 June 2019 • 0 Comments • Lire en Français

Cold sweats, screams, and even murder desires: on the one hand, WordPress errors make us nuts, on the other hand they are scarier than Jack Nicholson in Shining.

Is Hack Nicholson in Shining scarier dans WordPress errors?

“White Screen of Death” (yes, it exists, and it’s not a remake of Jaws), “Database connection error”, or “Error 500”: these are the nightmare of every webmaster. And believe me, there are plenty more ready to make you nauseous.

These mistakes, we pray they never happen. But one day, they always end up coming down on us.

And then, panic is on board. Especially when it’s the first time. If you’ve ever experienced this great moment of loneliness, you’ve probably wondered how to solve this damn problem that just fell on you.

And don’t tell me you called the firemen or an ambulance: that doesn’t count.

To avoid sleepless nights, violent outbursts and other legally reprehensible behaviour, WPMarmite presents the most common WordPress errors in this post. And, above all, how to fix them with step-by-step tutorials.

Here is the summary.

I. The main types of WordPress errors you may encounter

There are 4 main types of errors on WordPress: HTTP errors, PHP errors, MySQL errors, and JavaScript errors.

An HTTP error means that a web server has failed to transmit information to a browser.

HTTP errors are the most common ones you will encounter. They have a number, the HTTP code, which contains 3 digits (e. g. 301, 404, 500 etc.).

They are classified into 5 main families:

  • Informational codes, for those starting with 1 (e.g. 100 and 101).
  • Success codes, for those starting with 2 (ex: 200).
  • Redirection codes, for those starting with 3. Among them, you should be aware of code 301, which refers to a permanent redirection (it tells Internet users and search engines that content has been permanently moved or deleted).
  • Client errors (your browser), for those starting with 4. Here, for example, we can mention a 404 error, which refers to a page which could not be found.
  • Server error codes, for those starting with 5. For example, the famous 500 error refers to an internal server error. We’ll come back to this later.

On the second hand, we find PHP errors (PHP referring to the programming language on which WordPress is based upon).

PHP errors can occur when you tweak the code, or when a developer updates a theme or plugin (this is quite rare, but it can happen).

For example, you may have made syntax errors in your code (forgetting parentheses, adding spaces or characters).

Where is my error in the code?

Third, WordPress can also generate database errors. This is called MySQL errors (the name of the database management system used by WordPress).

Finally, you may also encounter JavaScript errors. JavaScript (JS) is a dynamic programming language.

Now that you have an overview of the types of errors you may encounter, I suggest you discover how to avoid them.

II – How to avoid WordPress errors?

1. Precautionary measures

It’s always good to repeat it: update your site regularly. This will not prevent possible mistakes from occurring – but you’ll minimize the risks.

Then, before making any adjustments and getting your hands dirty, always remember to back up your site (WordPress files + database).

I repeat: BACK UP your site.

At least, if a technical problem arises, you can make a U turn. And it will prevent you from wanting to throw yourself out the window, or break your computer screen.

To back up your site, there are several options, such as:

  • UpdraftPlus.
  • ManageWP (this service allows you to manage several sites at the same time from a single dashboard, but it also offers options to back up your sites).

Overall, only activate “safe” plugins and themes. For plugins, give maximum priority to those that are present on the official repository.

At the time of writing, there were more than 56,000.

Overview of some plugins present on the official directory

To make the right choice, consider the number of active installations, the ratings (number of stars), and reviews. If a plugin is very poorly rated, has a continuous stream of reviews, and is almost not downloaded, you will know that there is probably an issue.

If you want to use a plugin that is not on the official repository, be careful. Be sure to check its quality.

For the themes, it’s essentially the same. If you want a free one, there are nearly 4,000 of them on the official repository. For a premium solution, make sure the merchandise is serious. Is the theme frequently updated? What about support? Is it bought a lot?

To shop, you can go to Themeforest, the world’s largest template sales platform.

Finally, you can also limit the damage by doing your tests (adding new plugins, a theme etc.) on a staging site, or on a local environment, for example.

To do this, you can use Local by Flywheel or MAMP, for example.

2. Tools to solve your WordPress errors

Despite all these precautions, it is possible (and likely) that you will one day encounter an error on your site. In that case, don’t panic. It happens to everyone.

You will see that the solution to the problem is often not so hard to overcome, as long as you understand what’s going on 😉

And that’s the purpose of this guide!

To repair WordPress errors, you will need some tools (even if you may not use all of them every time, and at the same time):

  • An FTP (File Transfer Protocol) client, i.e. software that allows you to communicate with your server. Personally, I use Filezilla. But you can also turn to Cyberduck or Transmit.
    To connect to it, you need the login details that are in the welcome email sent to you by your web hosting provider.
  • A code editor. Sorry if this scares you, but you’ll probably have to tweak the code a little bit to fix the problem. But you’ll see: you don’t have to know anything to get away with it.
    Are you looking for a code editor? I can suggest Sublime Text, Brackets or Notepad+++.
  • A cPanel, an online manager that manages the entire server. It is available from most hosting providers. You can access it thanks to the login details provided to you by your host in his welcome email.

III – 18 WordPress errors and how to fix them

Now that you have a global view of WordPress errors, it’s time to get to the core of the problem: what they are and, most importantly, how to solve them.

I will “introduce” you to 18 of them and explain in a detailed tutorial how to deal with them.

1. 500 Error (Internal Server Error)

A 500 error on WordPress

Let’s start with a big classic: the 500 error on WordPress, also called Internal Server Error.

It can be caused by several things. But the most likely is that the WordPress.htaccess file has been corrupted.

Note: to know everything about this very important file, check out the article that Alex wrote about it.

An HTTP 500 error can occur when connecting to WordPress, on your wp-admin page, for example.

a. Check the.htaccess file

To see if the.htaccess file is guilty of the 500 error, just disable it. To do this, connect to your FTP and go to the root directory of your website, where your main domain name is configured.

This location may vary from one host to another. It may be called public_html, or www, or htdocs.

Le fichier .htaccess sur un FTP

Locate the.htaccess file and change its name (for example, call it.htaccess_old).

Try to visit your site and if it works, remember to save the structure of your permalinks on your dashboard, in Settings > Permalinks.

Permalink settings

This will generate a new.htaccess file and everything should be fine.

If the problem doesn’t come from here, skip to the step below.

b. Increase the PHP memory limit

An internal server error can also be caused by the fact that the memory allocated by your host is insufficient.

To increase it, this is done in the file wp-config.php. Open it via your FTP and add the following line of code:

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

This piece of code increases the RAM allocated to WordPress by the server.

Note that you cannot allocate the memory capacity of your choice, because your web hosting company can set a limit. For example, if you put 512M and your host caps at 256M, you will not get more than that. In that case, contact them to see what they can do about it.

c. Deactivate all your plugins

If the previous solution didn’t work, you can try to deactivate all your plugins. A compatibility error may be the cause of the failure.

If you have access to the back office of your site, start with deactivating the plugins, especially the most suspicious ones (those you have just installed, configured, or updated).

Go to Plugins > Installed plugins.

Deactivate plugins

Then activate them one by one and see what happens. If the error reappears as soon as you have activated a specific plugin, you have found the root of the issue!

If your dashboard is inaccessible, use your FTP and rename the plugins folder (call it for example plugins_test). The latter is located in the wp-content folder.

The path is as follows: wp-content > plugins

Le dossier plugins sur un FTP

But be careful, don’t stop there. Once the folder is renamed, try to display your site again.

As the plugins folder has changed its name, WordPress will automatically deactivate all plugins.

Then, rename it correctly (plugins), and go back to the Plugins page, on your dashboard.

Everything will be deactivated, you will even get notifications that will mention it to you.

You can now activate your plugins one by one to find the one causing the problem.

d. Change your theme

It still doesn’t work? Try replacing your theme with the Twenty Seventeen theme, which is bundled by default on each new installation.

On your Dashboard, go to Appearance > Themes. Install and then activate the theme.

If you can’t find it because you deleted it, click on Add a new theme.

You should find it at the top of the next page, on the featured themes tab.

e. Replace the wp-admin and wp-includes folders

Is the error still there?

If you answered “yes”, some files in the core of WordPress may have been corrupted.

Try replacing the wp-admin and wp-includes folders. To do this, download the latest version of WordPress and unzip the archive.

On your FTP, rename the wp-admin and wp-includes folders to wp-admin_old/wp-includes_old (it’s faster than deleting them), and send the new ones.

Download the Same version of WP as the one you have.

If all these solutions don’t work, you’re really out of luck. As a last resort, I advise you to contact your web hosting company to explain your problem.

2. The White Screen of Death

The White Screen of Death. Is this the last box office horror movie? It could – but most importantly, it’s a famous WordPress error’s name.

If this error occurs, you will quickly see it: as its name suggests, WordPress will display a blank page (yes, all white, with nothing in it).

And do you know what the main problem with this error is? You have no indication of what is no longer working because no message is displayed.

But you’ll see, we can fix that without getting into trouble. Discover some solutions right away.

a. Test your plugins

This damn White Screen of Death (WSOD) may be due to an incompatibility problem between your plugins. To do this, you will have to deactivate them and reactivate them one by one, following the procedure I gave you just before.

b. What if the problem came from your theme?

The WSOD can also be caused by your theme, especially if the problem occurred after its activation.

Deactivate it on your Dashboard in Appearance > Themes. Then activate a default WordPress theme, Twenty Nineteen for example.

If you do not have access to your Dashboard, go to your FTP. Change the folder name of your theme. This forces WordPress to use one of its default themes (those that start with Twenty).

The path is as follows: wp-content > themes

Of course, these themes must be in the themes folder. If you have not previously deleted them from your Dashboard, this will normally be the case.

Your site is back to life? Well done. If not, read on.

c. Increase the PHP memory limit

If you are still in trouble, try increasing the PHP memory limit following the instructions given above.

d. Activate the WP_DEBUG mode

This solution is much more technical – but if you haven’t found the source of the problem before, you will have to start working on it.

The debug mode will list all the errors that occur when your site loads. For security reasons, it is better to use it on a staging environment (but if your site is broken, you are no longer that close).

To activate it, go to the wp-config.php file.

Locate the following line:

pastacode lang=”php” manual=”define(%20′ WP_DEBUG’ %2C%20false%20)%3B” message=”” highlight=””” provider=”manual”/]

and change the value false to true.

The error(s) will then appear on your page.

Very often, you will see the path of the file(s) that cause issues with the name of the theme or plugin. Afterwards, check the updates, deactivate the guilty file, and eventually contact the plugin developer, if necessary.

e. What if the problem persists?

After all this, your site should normally be back in working order. If not, check that your host’s server is not down, and remember to clear your cache if you are using a solution dedicated to this (the WP Rocket plugin, for example).

If your site is down, you can clear your cache by deleting the cache folder from the FTP (wp-content > cache).

It may also be useful to clear your browser’s cache, which is often a problem after changes, and try to access the site privately so that you have no cache or cookie.

Finally, ask your host for advice if you are still facing this painful blank page.

3. Error Establishing Database Connection

Error establishing a database connection

This error occurs when your site is unable to connect to its database.

First of all, this can happen when your website receives a lot of traffic. The server can no longer keep track, and returns the error.

But most of the time, it fixes itself as soon as you update the site. If the problem is still there, you will need to follow the steps below.

Very often, a connection error to the database can occur because you made a mistake when entering or changing your login credentials.

But the database may have also been corrupted, or the server that hosts it can be down.

For information, WordPress consists of two main elements:

  • The core files.
  • The database.

The database is very important. It stores all of your website’s information (articles, pages, site settings, theme and plugins etc.).

a. Check the wp-config.php file

Usually, the Error establishing a database connection comes from the file wp-config.php. This is where your login credentials are located:

  • Database name
  • Username
  • Password
  • Host

If you have recently modified them, or if you have changed hosts without updating your wp-config.php file, you have a potential solution.

When you open the wp-config.php file on your FTP (it’s located at the root of your site), you will find the following lines:

Database inside the config.php file on a WordPress website

To check if your credentials are correct, you can check your MySQL database on your hosting account. If you have forgotten its password, generate a new one.

Then analyze that the login credentials in your current database match those in your wp-config.php file. If they don’t, replace them.

b. Repair your database

If your database is simply corrupted, it will have to be repaired. To do this, you will use a line of code to automatically optimize your database:

pastacode lang=”php” manual=”define(%20’WP_ALLOW_REPAIR’ %2C%20true%20)%3B” message=”” highlight=”” provider=”manual”/]

Add it to the end of your wp-config.php file

Then go to the following URL: yoursite.com/wp-admin/maint/repair.php

Replace your site.com with the name of your site, and follow the instructions on the screen.

When the repair is completed, remember to remove the line of code previously added to your wp-config.php file.

If the problem persists, contact your web hosting company – it’s possible that the server that hosts your database is down.

Come on, let’s move on to mistake number four right now.

4. Connection Timed Out

This error occurs when your site is trying to do more than your server can manage.

Here are some possible solutions (for their application, see previous errors):

  • Deactivate all your plugins: some can cause slowdowns if they are incorrectly coded or too heavy. Reactivate them one by one to see which one is problematic.
  • Use a default WordPress theme (e.g. Twenty Seventeen) because your theme can cause connection timed oute.
  • Increase the PHP memory limit in your wp-config.php file
  • Speed up your site using a caching plugin like WP Rocket.
  • Upgrade to a higher hosting solution.

5. Failed Auto-Upgrade

According to a 2018 Sucuri report, 36,7% of WordPress sites were hacked because they were not up to date.

Oh My God penguin

You understand what I’m getting at: update your sites. Even if you are afraid that the process will crash your WordPress.

Frankly, it can happen, but it’s not that common. And if that happens, all you have to do is follow our recommendations.

Let’s see how right now.

By default, WordPress automatically applies what it calls minor updates, and security updates. So you don’t have to do it.

You save time, but when a problem occurs, you can’t prevent it… You will easily recognize it: a blank page (the famous White Screen of Death) will appear, or a message indicating that the update has failed, for example.

WordPress indicates that this may be due to a problem with your Internet connection during the update, or a connection bug between the main WP files.

Good news: you can fix this error by trying your luck again. If this is not enough, you will have to update manually following this tutorial from the Codex.

6. Maintenance Mode Following Upgrade

When WordPress activates updates, it automatically makes your site unavailable and installs a maintenance file.

Most of the time, everything will go well. But, sometimes, the process does not work entirely, and your site remains blocked in maintenance mode following upgrade.

To make this mode disappear, connect to your FTP and delete the.maintenance file at the root of your site.

Note: if you do not see this file, its display may be hidden by your FTP. Here’s how to make it visible on Filezilla. Click the Server tab > Force hidden files to be displayed.

How to see hidden files in FileZilla to detect this WordPress error

7. Syntax error (parse error)

Parse error

I can see the situation. You’ve just added a slice of code to redirect to the home page after a disconnection. And suddenly, your site crashes.

Chill out: you probably made a parse error forgetting a curly bracket or a parenthesis.

Usually, the error message that appears tells you on which line (or on the two-three lines before and after) of the functions.php file the error is located.

For more information, you will need to activate the WP_DEBUG mode as explained above.

Once the problem has been identified, fix it: your site should be available again.

To avoid this concern in the future, plan to test beforehand on a staging environment (e. g. local), and not directly on your live site.

8. You cannot connect to your back office

a. You have forgotten your password

What the hell is that password? Is that the name of your pet? No, it doesn’t work. Maybe your mother-in-law’s name? Uh, neither.

One thing is certain: it is impossible to get your hands on the password that allows you to connect to your Dashboard.

To resolve this matter, the first solution is to click on the Lost your password link.

Password lost on WordPress

By entering your username or email address, a new password should be sent to you by email.

Get new password on WordPress

I said “should” because that’s not always what happens. If this solution does not work, you can reset your password via PhpMyAdmin.

To do this, connect to your cPanel as explained above.

In the Databases section, select phpMyAdmin.

phpMyadmin on CPanel

Then choose the database associated with your site in the left part of the window.

Among the many tables that will appear, select the one called wp_users (the prefix wp may be different if you gave it a different name at the time of installation).

Edit PhpMyadmin

Click on Edit and change the password on the user_pass line, and select MD5 in the drop-down menu in the Function column.

User pass php

Save your changes and you will normally be able to log in with your new password.

To remember your passwords, you can use a manager like Dashlane.

b. WordPress prevents you from connecting to your Dashboard

Perhaps more annoying than forgetting your password: here is the impossibility of connecting to your Dashboard. You enter your username and password, but WordPress still redirects you to its login page.

Here again, there can be several reasons. I advise you to try the following solutions, one after the other:

  • Deactivate your plugins (see error 1).
  • Clear your browser’s cache (see error 9).
  • Enable the default WordPress theme (see error 2).
  • Delete the.htaccess file (see error 1).

9. The changes you made to a theme remain invisible

For a few hours now, you have been doing some maintenance work on your site by modifying its appearance, notably using CSS code.

That’s it, you’ve just finished. And there, surprise: when you go to your new pages, no changes have been taken into account.

To end this “error” in the display, simply close the corresponding tab and open it again, or clear your browser’s cache.

If you are using Chrome, select History > Clear Browsing Data > Images and Cached Files. Click on Clear Data and the problem should be resolved.

Clearing the cache can help resolve WordPress errors

If your changes still do not appear, perhaps you are using a caching plugin. In this case, delete all the caching files generated by the plugin.

WP Rocket clear cache

10. Your images generate errors

Until now, your site has been running smoothly. But now your images are causing you trouble.

They no longer appear on your site? An error prevents you from downloading them to your Media Library?

You don’t understand the reason why. You know you haven’t touched any of the settings.

The cause of this embarrassing situation most likely lies in incorrect file permissions. Basically, WordPress doesn’t know (anymore) that you have permission to submit files to it.

This can be caused by an update of your web hosting provider, or if your site has been hacked.

If everything works except your images, changing the permissions of your files should solve the problem.

To do this, connect to your FTP, and navigate to the uploads folder.

The path to follow is: wp-content > uploads.

The uploads file on your FTP

Select uploads by clicking on them, but do not enter the folder. Right-click and choose File Access Rights.

Then enter the numerical value 755, check the Recursion in subfolders box and Apply to all files and folders (see capture below).

The uploads file's permissions

Then do the same for the files inside the folder.

Right click on uploads > File access rights > Numerical value 644 > Check Recursions in sub-folders > Apply only to files.

Permissions 644 des fichiers

11. Allowed memory size exhausted

For a server to work efficiently, it needs enough memory set by your web hosting company. Your WordPress site uses this memory to run its code.

If you don’t have not enough memory, you will see the following message: “Allowed memory size of xxxxxx bytes exhausted”.

To solve this problem, you can increase the memory capacity in your wp-config.php file by adding the following line of code:

pastacode lang=”php” manual=”define(%20’WP_MEMORY_LIMIT’ %2C%20’64M’%20)%3B” message=”” highlight=”” provider=”manual”/]

As indicated in error #1, contact your web hosting company if your server is restricted.

Well, well, well: all of a sudden, your sidebar has just been upgraded – it’s no longer displaying next to your content, but below it.

It challenges your entire design, and it’s not pretty at all.

Most of the time, this concern comes from either the HTML code or the CSS code, especially if you have recently changed the theme and/or made changes in the code.

First of all, it is possible that some div tags are missing or that there are too many. To find out, you can use the code validation service offered by W3C, the organization responsible for promoting the compatibility of web technologies.

If this does not solve the issue, you should look at your style.css file. Maybe your margins are too important (their values are too large).

13. 404 Errors

A 404 error means that a page does not exist or no longer exists.

La page d'erreur 404 du site WooCommerce
The 404 error page of WooCommerce

This can happen when hyperlinks are broken, if the structure of your permalinks has changed, or when you delete or rename content or categories.

This is not good for your SEO or the user experience.

To manage 404 errors on your site, install and activate the Redirection plugin.

14. You cannot publish scheduled articles

Here’s a handy feature of WordPress: make it possible to publish an article later by scheduling it in advance.

When you have finished writing an article, you can schedule it for a future date by clicking on the Publish link (if you use Gutenberg).

Delay post publication

The reason I mention it here is that sometimes it doesn’t work because no one visits the site. As a result, CRON tasks (scheduled tasks) cannot be started. One solution is to connect a service like Uptime Robot.

Alternatively, you can manually validate the publication of the post.

Finally, you can use the Scheduled Post Trigger plugin. It will check that your scheduled posts have been published. If not, it will do it for you.

15. Maximum execution Time exceeded

If one day you see on your screen the following messages “Maximum execution time of 30 seconds exceeded” or “Maximum execution time of 60 seconds exceeded”, it means that an action cannot be performed.

You can start by checking with your host if it has an answer to this problem.

Otherwise, the Codex specifies that there are 2 ways to solve it:

  • Edit the.htaccess file by adding the following line of code:
    php_value max_execution_time 60
    However, I can only advise you to save and duplicate your.htaccess file in a safe place (on your desktop, for example) before starting any manipulation. In case of a problem, all you have to do is restore the old version.
  • Edit the php.ini file by inserting this snippet:
    max_execution_time = 60
    First, you must create a php.ini file at the root of your site – but not all hosts take it into account. It’s quite technical, so if you’re not sure about managing it, don’t go for it.

16. You can’t delete a WordPress plugin

A plugin is often great. This allows you to add features to your site without having to code.

But it often happens that you no longer need to use it. In this case, it must be deactivated and deleted.

You probably know how to do this. This happens on your dashboard in Plugins > Installed plugins.

You just have to click on Deactivate and Delete. It’s as simple as that.

Delete a plugin

Except when the plugin refuses to delete itself. Yes, it happens – and it’s often due to poor quality code.

Then what should you do? Leave the plugin inactive? After all, it doesn’t stop your website from functioning, right?

But I wouldn’t recommend it. As long as it is not deleted (and even sometimes when it is), a plugin stores information in your database. And the bigger your database gets, the more your site will tend to load slowly.

The solution is to use your FTP client and manually remove the defective plugin.

Once at the root of your site, follow the following path: wp-content > plugins > plugin name.

Supprimer les plugins de votre FTP

Then right-click and select Delete to delete it completely.

17. The wp-config.php file already exists

The  wp-config.php file is one of the most important files of your WordPress installation. It allows you to make the link between the core of WordPress and the database.

It contains in particular the login credentials of the database, the prefix of its tables, or even security settings.

Sometimes, this file indicates the following message: “The file wp-config.php already exists”.

To solve this problem, you can try to clear your browser’s cache (refer to error 9 for instructions).

18. Your site has become slow

This is not a WordPress error per se, but it can affect the proper functioning of your site, and upset your visitors.

What if your site slows down significantly overnight?
How can you find the cause of this issue, and solve it?

To find out which file or script is to blame, you can use one of the following services:

Let’s take the example of GTmetrix. I did a test with WooCommerce‘s website.

Once the web page has been analyzed, the tool offers you a series of recommendations to optimize your page.

Below, we can see that some images are too heavy. GTmetrix tells you which ones, so you can easily locate them to reduce their weight.

Test de GTmetrix

To go further on WordPress performance, check out this article from our blog: How to speed up a WordPress site without breaking the bank.

IV – Conclusion

Facing WordPress errors is never a pleasure. Fixing them often requires time, energy and reflection.

Throughout this article, you may have noticed that many issues often had the same cause:

  • One or more defective plugins.
  • A miscoded theme.
  • Corruption of the.htaccess file
  • Problem with your host’s server.

To overcome these mistakes, the key is to keep a cool head. If possible, remember to back up your site before proceeding with any manipulation.

Also to ask your web hosting company for help, and try to find a solution by proceeding step by step.

Now, it’s your turn. What WordPress error gives you the more trouble? Are there any that we have not mentioned?

Let us know your own solutions. It will also help other readers that may be stuck!

And if you enjoyed this article, don’t forget to share it on social networks.