Search the site:

Copyright 2010 - 2024 @ DevriX - All rights reserved.

Fixing WordPress Errors? It’s Easy If You Do It Smartly

Fixing WordPress Errors It’s Easy If You Do It Smartly

What’s the WordPress error that gave you a headache most recently?

Oh, don’t tell us! Was it an internal server error? Or maybe it was exhausted memory… again! Or you had issues establishing a database connection?
Fingers crossed it wasn’t the dreaded white screen of death.
Yeah, been there, done that.

Building a modern WordPress website can be challenging . You have to consider the business’s needs and functionality requirements, and, at the same time, think of usability, design, UX, SEO, and whatnot.

Furthermore, the WP ecosystem is constantly developing and evolving, which may make it difficult to keep up with what’s new

Regardless of whether you are a pro or you are building your own DIY project, you may encounter hard-to-fix WordPress errors that require your immediate attention.

Don’t get us wrong. WordPress is the best content management system. It’s easy to use, extremely powerful and you can create everything, from blogs to digital publications, enterprise websites,and eCommerce platforms.

In fact, WordPress is used by 43% of all websites. This includes some of the biggest brands in the world, such as TechCrunch, Mercedes-Benz, Vogue, The Walt Disney Company, and even the White House!

CMS Usage

However, all technology tends to break occasionally, and when you come across an issue, you need to know how to fix it.

In this article, we list the most common WordPress errors that may occur when developing a website, and provide smart solutions, as well as tools that you can use to fix them.

Read on to up your WordPress game!

1. Blank White Screen

Let’s start with the most terrifying WordPress error – the blank white screen.

When you try to open a WP website, there’s nothing worse than seeing this:

Blank White Screen

This means that your WordPress website is unreachable to admins and users. It can bring additional problems to your website too.

Let’s have a look at what causes this problem first.

Causes

TIn 90%of the cases, the so-called “White screen of death” is caused by: a) an error in PHP coding, or b) a case of memory exhaustion.

The first thing that you need to check here is whether you can access the admin panel on your WP website. In most cases, you can access it by keying in the address bar:

https://yourdomain.com/wp-admin

If everything is fine, you will be redirected to a WordPress login page:

Causes

If not, a different blank white screen may appear on your browser, for example, if you use Chrome the screen will show an alert in the form of HTTP 500 Error.

Causes2

Coding Error Solutions

First things first, you will need to check whether you’ve written a bad line of code on your WP website – just one mistyped character can bring down your entire website!

1. Use a SFTP Client

If you can’t access your admin panel, you can always connect to a Secure File Transfer Protocol (SFTP) and manually retrogress the bad code. STFP is used for file transfers as a much more secure option than a standard FTP.

To connect to an SFTP, you will need an SFTP client first. There are many free and paid options to consider, such as:

SFTP client

When you open the SFTP client, you will need to enter the following settings:

  • Connection type: SFTP (not regular FTP)
  • Address/URL/Hostname (your IPv4 Address)
  • Username
  • Password
  • Port

Web hosting providers should be able to make this information available to you.

2. Try Debugging

Another solution to the “White screen of death” is to dig a little deeper into your WordPress code and run a debugging process that will uncover any errors in your PHP code.

To run a debugging process for your website, you will have to access the wp-config.php file within your WordPress installation files. There, you should find the following:

Debugging

Try to replace false with true, and refresh your website.

Now, instead of the white screen, you should see a screen with error messages in your browser. In most cases, the errors are marked with the exact line.

For example:

Cannot get_posts()in /var/www/html/wordpress/wp-content/plugins/my-test-plugin/my-plugin.php on line 67

If you know how to change your code, you can solve the problem yourself.

If it’s a plugin issue and you don’t know how to deal with it, it’s often best to contact the plugin developers and ask for their support.

If the plugin troubleshooting can’t fix the problem, perhaps the problem lies in the theme’s code. You might even see a message like this on your white screen:

Parse error: syntax error, unexpected $end in /home/name/public_html/wordpress/wp-content/themes/your_theme/functions.php on line XXX

WordPress can’t function properly if its code is broken, so you’ll have to revisit the theme files and modify them so that they are exactly the same as before the blank white screen appeared.

Use FTP client to upload a working version of the functions.php file or use a child theme to add changes to your theme without losing the original code.

Memory Limitation Solutions

If the above doesn’t fix the white blank screen WordPress error, the next possible cause is – memory exhaustion.

In most cases, this can be solved by accessing the wp.config.php file of your WP install and adding the following code:

Memory Limitation

You can also use the .htacess file located in the WP root directory, by adding the following:

php_value memory_limit 128M

Or, you can do that from the php.ini which bumps the limits across all installs on the server in general.

The wp-config.php sets the memory limit for each WordPress site that has the php.ini file. This can affect your whole server.

The php.ini is the parent setting, and so you can set up WP to whatever you want within php.ini’s range.

It’s also important to note there is a WP_MAX_MEMORY_LIMIT where you can define the max amount of memory WP should use, especially if you have plugins gobbling up your bandwidth.

2. Internal Server Error

The internal server error is another common WordPresserror that users and developers encounter frequently in their websites.

It occurs when there’s a problem with the server that is hosting your WP website.

Causes

Internal Server Error

This error is frustrating because it doesn’t indicate how to solve the problem.

But, fret not, we’ve got your back!

Solutions

Here’s how to handle the issue.

1. Create New .htaccess File

Open your WP root directory in FileZilla or whichever FTP client you prefer to use. Open the public_html folder where you can find the wp-admin and wp-content folders.

Somewhere in those two folders, your .htaccess file resides. If you don’t see it immediately, click “Server” and then select “Force Showing Hidden Files.”

Create New .htaccess File

When you find the .htaccess file, rename it into “.htaccess.bak.” The file now exists as a backup with a .bak extension, but it won’t be taken into consideration by the server as it’s no longer a .htaccess.

Next, go to your WordPress admin panel and go to “Settings.” Select “Permalinks.” Scroll to the bottom and click “Save Changes.”

Create New .htaccess File second

To check whether you solved the problem, try to access your website again.

Now, if the 500 Internal Server Error is not there anymore, it means that the problem was caused by a bad .htaccess file. But, if you still see the 500 Internal Server Error, you will have to dig a little deeper to find the cause and solve the problem.

2. Plugin Deactivation

If you’re still able to access your WP admin, try solving this problem by deactivating each installed plugin one by one.

(If you can’t access your WP admin panel, scroll down.)

Plugin Deactivation

Again, try refreshing your website to see if the error still appears. If the error is gone, it means that it was caused by a corrupt plugin.

After diagnosing what plugin caused the problem, you have two options. One, if you’re the plugin developer, investigate and fix the issue, and two, if it’s a third-party plugin, contact the tech support team or find a replacement.

If you can’t access your WP admin, you will have to try to deactivate the plugin by accessing via the FTP client again. Open the WordPress root directory and access the wp-content folder. This folder contains all your plugins.

Plugin Deactivation

Rename the plugin folders to something else. This will deactivate all the plugins on your WP site. Now refresh the website to see if the internal server error is still present.

If not, the problem is solved but, you still need to discover the plugin that caused the error.

Start by activating plugins one by one and refreshing the website after each activation. This will help you find out which plugin is corrupt and get rid of it for good.

At the end of the process, rename your plugins folder with the original plugin’s name.

As you can see, this internal server error isn’t that difficult to solve, but it does require some troubleshooting to locate it first.

3. Exhausted Memory

Memory exhaustion is another one of the most common WordPress errors.

The problem occurs on websites that need larger PHP memory.

PHP is a server-side programming language, and every WordPress website needs a WP hosting server to perform properly.

Causes

Servers operate the same as every other computer. They, too, need memory to effectively run multiple functions and applications on websites. That’s why server administrators portion out a certain amount of memory size for a different application that includes PHP.

In most cases, when your WP code needs more memory, the following message is displayed in your browser:

Fatal error: Allowed memory size of xxxxxxx bytes exhausted (tried to allocate xxxxxx bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

At first, WordPress will make an attempt to automatically grow the PHP memory limit if it’s under 64MB. But, in most cases, it’s not enough.

Solution

With that, let’s have a look at how we can solve the memory limit problem.

Editing the wp-config.php File

Similarly to the previous solutions, you’ll have to access your WordPress root directory with an FTP client. Or, you can access it with a file manager on your hosting panel.

Find the wp-config.php file and insert the following code anywhere before the line that says /* That’s all, stop editing! Happy blogging. */ at the end of the file:

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

This will tell WP to raise the PHP memory limit up to 256MB.

When you’re done, you need to save your changes and upload the wp-config.php file back to your server. Refresh your website to see if the error still appears.

If this solution doesn’t work, it usually means that your hosting provider does not allow you permission to increase your PHP limit manually. In that case, you need to contact them and ask them to help you out.

4. Error Establishing a Database Connection

This is a common WordPress error that can put you in panic mode if you don’t know how to solve it.

Related to the “White screen of death”, an error in establishing a database connection means that your website can’t access the database, and, consequently, crashes.

Just like any other error, this has to be fixed immediately because it can seriously damage your sales, traffic, and page conversion.

Your WordPress website contains information such as posts data, page data, meta descriptions, plugin settings, login credentials, etc.

Each piece of data resides in a MySQL database. The only type of data that is not stored in your MySQL database is your website media content (images) along with your theme central files (index.php, wp-login.php).

When a user tries to visit your website, PHP renders your website code and pulls information from the database. With that, the information on the user’s browser screen is displayed.

If this process doesn’t function as it should, it will result in the following browser message:

Plugin Deactivation second

Causes

There are a few reasons that frequently cause an error in establishing a database connection:

  • Wrong Database Login Credentials – Information that your WP site uses to link to your MySQL database.
  • Corrupted Database – With the ongoing adding and deleting of files and plugins, corrupt databases can appear.
  • Corrupt WordPress Installation Files – This one happens more often than you realize.
  • Database Server Problem – A common problem with shared hosting, caused by traffic overload.

Solutions

First, if a problem like this appears on your WordPress website, you will have to perform a backup of your MySQL database. The next few steps will show you how to do this successfully:

Login to your cPanel account, select “Databases” and then click on “phpMyAdmin.” Select the database that you want to backup.

Click “Export.”

Solutions

Choose “Quick Export.” Your database export will now be downloaded to your computer’s default download location.

The next thing you need to do is restore your MySQL database from your backup. Again, enter your cPanel account and choose the database that you want to restore.

Next, click the “Import” tab.

Solutions

Click on the “Choose file” button to browse your MySQL backup file. After that, click “Go.”

Once you’ve ensured a successful backup of your MySQL database, it’s time to start solving the “Error in Establishing Database Connection” problem.

1. Login Credentials Checkup

The first thing when you try to solve this issue is to check your database login credentials.

These details are piled in the wp-config.php file located in the WordPress root directory. This file holds important data that needs to be in a specific order to establish a database connection.

Name

// ** MySQL settings ** //
/** Name of database for WordPress */
define('DB_NAME', 'xxxxxx');

Database username

/** MySQL database username */
define('DB_USER', 'xxxxxx');

Hostname

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

To access the wp-config.php file, you can either use an SFTP client like in the previous cases or, you can use the cPanel.

Open your cPanel and click on “File Manager” and “Edit File.” Don’t edit anything, just ensure that the files are placed in the exact order as above.

Now, start by checking if the database name is correct. Login to your “phpMyAdmin” file under Databases.

Hostname

The database names will appear on the left-hand side. Look for the dbname in your wp-congig.php file. Compare that name with your database name in the cPanel. If the names match, the problem is not located there.

2. Corrupt Database

Your MySQL database can become corrupt. This can happen due to countless adding and removing of plugins and tables in your WordPress website. When you log in to your WP dashboard and receive the following message

“One or more databases are unavailable”

it means that the database is corrupt.

But, don’t worry! WordPress has an integrated repair mode that you can start by adding the following code to the bottom of your wp-config.php file:

define('WP_ALLOW_REPAIR', true);

After inserting the code, go to your browser and find the location of the repair mode with exampledomain.com/wp-admin/maint/repair.php.

WordPress will offer you two options. One of them is to repair the database and the other one is to optimize it. When you solve a problem, quite often, the wisest choice is to repair the damage.

Corrupt Database

After you conduct the repair mode, make sure that no one else can access this by removing the code above from the wp-config.php file.

3. Corrupt Files

One of the reasons that can cause an error in establishing a database connection is corrupt files.

Corrupt files can happen due to a problem with file transfers via FTP, a hosting problem, or worse, a hacking attack. Luckily, these are all fixable.

But, first, you must perform a backup of your entire WordPress website.

First thing, download the latest version of WordPress. Then, unzip the WP files to your computer. Find the wp-content file and delete it. Also, look for the wp-config-sample.php file and delete that as well.

Corrupt Files

Upload the remaining files to your WordPress website with an SFTP client. With that, you will overwrite the existing files.

What this does is replace every possible corrupt file and guarantee that your website now has brand new undamaged files.

Cache your website and refresh it after doing this. The problem should have now disappeared from your WP website.

5. The 404 Not Found

WordPress is a robust CMS platform. However, sometimes, a minor code error or a plugin issue can make your website unreachable to the users.

This leads us to another common problem that developers and users face when it comes to WordPress – a 404 error.

The 404 Not Found

The first thing that you need to keep in mind when you notice this type of problem is to not freak out!

Your content is still on your website and the site still exists. The easiest way to fix this is by accessing your “Permalinks” option in your WP dashboard. Enter in the dashboard, go to “Settings > Permalinks” and click the “Save Changes” button.

Normally, this will solve the 404 error. But, if the problem still appears, you can try to manually update the .htaccess file located in your WordPress root directory.

For this purpose, use an FTP. Try to temporarily modify the .htaccess file by changing the permissions to 666 (don’t forget to set the permissions back to 660 when you’re done with the fix).

Refresh the website to see if the problem still appears.

6. The 403 Forbidden

This is a WordPress error that is displayed when the server’s permission doesn’t permit access to a given page. This type of problem is usually displayed in the browser with text such as the following:

403 Forbidden – You don’t have permission to access ‘/’ on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Causes

The root of this problem lies in badly configured security plugins. Many of WP’s safety plugins can block an IP address if they determine that the IP address could be hostile.

Another possible reason for the 403 forbidden error is a broken .htaccess file. Let’s see how you can solve the problem if it occurs.

Solutions

Generally, there are two solutions to the 403 error:

1. Deactivating Plugins

The first option that you need to try is to temporarily deactivate every plugin on your WordPress site. If this solves the problem, you’ll have to figure out which plugin has caused the error and delete it from your WP site.

Start by activating all plugins, one by one, and refreshing the page. Then, when the problem occurs again, you’ll know which plugin causes the problem.

2. Fixing a Corrupt .htaccess File

In some cases, the 403 forbidden error happens because of a corrupt .htaccess file in your WP site. To solve this problem, you’ll need to connect to your website by using an FTP client.

Next up, you’ll need to locate the .htaccess file in the root folder of your WordPress website. Download the .htaccess file to your PC to create a backup. After downloading, delete the file from your WordPress directory.

Now, try to access your website again. If the 403 message no longer appears, it means that the .htaccess file was indeed corrupt.

Now, to yield a new .htaccess file for your WordPress website you’ll need to go to your WordPress panel and open “Settings > Permalinks.”

Click on the “Save Changes” button and WordPress will generate a brand new .htaccess file for your website.

Problem solved.

7. The Scheduled Maintenance Mode

If you use a shared hosting service for your WordPress website, it’s likely that at some point, a WordPress update process will leave your website in temporary maintenance mode.

As a result, your website will not be accessible to users for that period of time. This leaves visitors with the following message in their browser:

The Scheduled Maintenance Mode

Causes

Maintenance mode page doesn’t always mean that there’s an error on your WordPress website. It can happen every time there is a WordPress update.

WordPress puts your website in maintenance mode until the server updates and file extractions are done.

If everything goes well with the update, the scheduled maintenance message will not last more than a few minutes.

But in some cases, a slow response from a server or low memory can put your WordPress website in maintenance mode for an undetermined amount of time.

Solution

First of all, check if you’ve done your WordPress update properly. An incomplete or blocked update process can cause problems for your website when it tries to come out of maintenance mode.

Once you’ve updated your WordPress version, you need to delete the .maintenance file from your WP root directory by using an FTP client.

WordPress can hide this file from you for security purposes. If you can’t find the file, make sure that you enable the option to display hidden files in FileZilla by clicking on “Server > Force showing hidden files.”

Initially, WordPress creates the .maintenance file when the updating process starts. If you don’t remove this file from your WordPress root directory, your website can stay in maintenance mode forever.

Bonus: What Can You Do to Prevent WordPress Errors

The WordPress errors above may appear alarming, but, luckily, they can be solved just like every other problem.

However, prevention is always better, isn’t it? So, what can you do to protect your WordPress website from these unwanted situations?

  • Regular Updates – An out-of-date WordPress version or an old WP theme can cause a serious mess and compromise your online presence. Files may not be synchronized, and some functions may stop working altogether because they depend on programs and plugins that need an update.
  • Plugin Checkup – WordPress is an open-source CMS platform. This means that every developer can offer his work and contribute. However, as a result, the quality of plugins in WP may differ, and this can lead to some of the problems above. That’s why you need to check, re-check, and delete every plugin that causes problems.
  • Theme Checkup – Themes can get corrupted and infected just like plugins do. This can block your website’s functions. Before you buy a theme for your WordPress website, make sure that it has been tested, and that you’ll have ongoing support from the authors.
  • Inspect .htaccess file – As you’ve probably noticed, the .htaccess file controls a lot of security aspects of your WordPress website. This includes permalinks and redirects. There are safety plugins that modify this file to prevent access from suspicious IP addresses. Follow the steps above to ensure a healthy .htaccess file that doesn’t cause problems with your site.

Wrapping up

There you have it, the most common WordPress errors that developers encounter.

We hope that this article can help you navigate these common problems. Problems that can, unfortunately, jeopardize your WordPress website.

Even though they may look simple, WordPress websites and platforms work like Swiss clocks – dependable and functional but full of complex mechanisms (code and plugins) that keep things running smoothly.

Because of that, the solutions for WordPress errors are not always easy.

When you’re not sure if you can solve those problems/errors, it’s always a wise choice to approach professionals for safer WP updates and continuous monitoring.

At the end of the day, WordPress troubleshooting is a serious process and key to a successful business and better sales.

Don’t miss out on potential customers because of a dysfunctional online presence.

    Let DevriX help you on this!

    We believe there is a reason you research this topic. Share your goals and pain points and let us help you with them.

    We value your privacy. DevriX will use the information you send to provide the consultancy you need. We may also send you relevant content and services information. You may unsubscribe from these communications at any time.