We think you’ll agree when we say: A 503 service unavailable error is one of the most baffling errors you can ever encounter on your WordPress site.
Main reason being the error doesn’t make it clear what’s wrong. The fact that it can be caused by a number of things makes matters worse. Moreover, depending on the server configuration this error can be displayed differently. For example, you can see these error codes instead:
503 Service Unavailable
Http/1.1 Service Unavailable
HTTP Server Error 503
HTTP Error 503
Turns out fixing a 503 service unavailable error is relatively easy and in this post we show you exactly how.
Note: In this tutorial, we will show how to debug and fix the error for WordPress based websites. However, similar steps can be applied to any CMS.
Table of Contents
A 503 service unavailable error can be caused by a number of things including (but not limited to):
- Buggy plugins or themes
- A misbehaving custom PHP script
- Insufficient server resources
- Server glitches
- Malicious attacks such as the infamous Distributed Denial of Service (DDoS) attack
We will go over each of these causes and offer various solutions regarding how you can fix the 503 service unavailable error.
Faulty plugins are responsible for most of the errors you will encounter in WordPress. In fact, a buggy plugin is the leading cause of the 503 service unavailable error in WordPress.
If you encountered the 503 error after installing or updating a particular plugin, you most definitely know the culprit. All you have to do is delete the plugin in question and your job is done.
If, however, you have no idea which plugin (or what exactly) is causing the 503 error, you should begin the diagnosis by deactivating all plugins.
But how do you deactivate all plugins considering you can’t access your WordPress admin dashboard?
Deactivating All WordPress Plugins
This is how our test WordPress directory looks via File Manager in Hostinger:
Inside your WordPress directory, locate and open the wp-content folder, which contains your plugins, themes and media among other things.
Right-click on your plugins folder and rename it to plugins-old:
This deactivates all plugins at once. Now rename plugins-old back to plugins and reload your website. If the 503 error is gone, a plugin is the cause of your current predicament.
All you have to do now is identify and delete the problematic plugin.
You should now be able to login to your WordPress admin dashboard via the browser and activate the plugins one by one.
Every time you activate a plugin, reload your site to pinpoint the buggy plugin. Once you find the naughty plugin, login into your plugins folder via FTP and delete it:
If deactivating plugins didn’t fix the 503 service unavailable error, read on for more solutions. Now, let’s check if your theme is the problem.
Problematic WordPress Theme
At times, buggy PHP script that throws up a 503 error could be part of your theme. For this part, we will switch to a default theme such as Twenty Seventeen. By the way, it’s advisable to keep the default theme even after installing a new theme since it (default theme) acts as the fallback theme should your theme fail.
Deactivate WordPress Theme
Before we deactivate (or delete your theme should it be the problem) we must create a backup of the same. Connect to your WordPress site via FTP and navigate to the wp-content -> themes folder.
Next, delete your active theme and reload your site. If the 503 error is gone, your need to fix/update your theme. When this is not an option, get a new copy or a different theme.
If the 503 service unavailable error persists, perhaps a broken custom PHP code snippet somewhere on your site is responsible.
Faulty Custom PHP Code
At times, 3rd party code by external services or code snippets you add to your site could cause a 503 error. But how do you determine if the code is the problem.
But since the 503 error often locks you out of your WordPress admin, we shall use
@ini_set constants available to WordPress.
To enable debug mode in WordPress and write errors to a log file, follow these steps:
- Open your WordPress directory via FTP or File Manager.
- Open the wp-config.php file
- Scroll down to where WP_DEBUG is defined. It looks like this
define ('WP_DEBUG', false);. If it is missing, we will add it just above the line that says
/*That's all, stop editing! Happy blogging.*/
- Insert the DEBUG magic codes. Just change the above
define ('WP_DEBUG', false);code to:
define ('WP_DEBUG', true);
define ('WP_DEBUG_LOG', true);
define ('WP_DEBUG_DISPLAY', false);
@ini_set ('display_errors', 0);
- Save changes
Now, reload your site to provoke the error. Next, locate a file known as debug.log inside your wp-content folder in your WordPress directory.
This file contains all the errors on your website. If your 503 service unavailable error is caused by a custom code snippet, it will show up somewhere with details of the error.
Eliminate/replace the problematic code and reload your site. If the 503 error persists, the problem could lie in your web server.
A number of server-related issues can cause the 503 service unavailable error. Usually, 503 errors caused by server problems disappear automatically after a few minutes.
If the error persists after trying the solutions we’ve already covered, here are a couple of things you can try.
Increase Server Resources
Some shared hosting plans simply don’t have enough power to accommodate heavy usage. If your host has bottlenecks as far as server resources go, perhaps it’s time you switched to a new WordPress hosting service host or upgrade your hosting package.
Are you getting the 503 service unavailable error consistently? If so, check your Google analytics. If you’re getting more traffic than usual, you’re definitely short of server resources.
However, if you don’t have the extra traffic but still see the 503 error, your problem doesn’t stem from inadequate server RAM or memory.
Limit Google’s Maximum Crawl Rate
To index your content, Google uses specialized scripts commonly known as crawlers. They visit your site regularly to gather content and determine other ranking metrics.
While it is uncommon, this crawling process can take a toll on your server resources consequently slowing down your site. To circumvent this and get rid of the 503 error, you can limit Google’s crawl rate using Google Search Console.
Note: The changes you make will be in effect for 3 months. Additionally, if you have non-WWW and WWW versions of your site, you have to do this for both.
Login to Google Search Console and select your website. Next, click the gear icon and select site settings as shown below:
On the next screen, adjust the Google crawl rate by dragging the slider to the left side:
Limit WordPress Heartbeat
According to WordPress.org, “…the Heartbeat API is a sample server polling API built in to WordPress, allowing near real-time, frontend updates.” It’s responsible for features such as post autosaving and so on.
The WordPress Heartbeat API fires a file known as admin-ajax.php among other queries at regular intervals when you’re logged into your site.
This functionality consumes your server resources, but you can limit or disable it completely. When you recover your site, you can use the Heartbeat Control WordPress plugin to limit this functionality instead of completely disabling it.
To determine if WordPress Heartbeat is the cause of the 503 service unavailable error on your WordPress site, add the following code into your theme’s functions.php file right after the opening
Save your changes and reload your site. If the 503 error is gone, take a breather. But if the 503 service unavailable error is still there, it means the WordPress Heartbeat API is the least of your troubles.
If the above code didn’t fix the 503 error, don’t forget to remove the code from your functions.php file.
If none of these solutions works for you, perhaps we missed a solution that could work for you. For this very reason, don’t hesitate sharing with us in the comments so we may find you the help you need.
Moreover, take note that the 503 service unavailable error is mostly the result of faulty PHP code such as a buggy plugin or theme.
Equally important is to note that 503 errors caused by server glitches oftentimes clear on their own, so always reload your site a while later to test if the error still persists.
Regardless of what happens, realize you can always fix a 503 service unavailable error without breaking a sweat. As such, there’s really no need to panic since it’s not a permanent situation.
Have you ever encountered the 503 service unavailable error? How did you fix it? Do you have a question or suggestion? Please share with us in the comments below. Thanks in advance!
This post was last modified on January 15, 2018, 7:46 pm