You have tried to access your website but what… All you see is a 503 Service Unavailable Error!! You are just wondering as last time you had left your website properly working. What has happened all of a sudden? Don’t panic… here is what you want to know about 503 error and its various fixes.

If you are just a beginner and working on your website, it is quite possible that you run into some errors. It will be a great disappointment as you are new to it. But where there is a problem, there is obviously a solution. This is true for all the major CMSes as supported by an active community to help you out even on exceptional things you encounter. But there are some common errors though encountered rarely like 503 service unavailable error. The main difficulty in handling this error is – finding the reason that returns a 503 error. So, here at Templatetoaster website builder i have made a try to lessen your problem by giving you a detailed view of this very error with possible causes and fixes. Let’s get down to business starting with “What a 503 service unavailable error actually is”!

What is 503 Service Unavailable Error?

A 503 service unavailable error indicates that the server is inaccessible. It is just an HTTP status code to tell that server is temporarily unable to handle the request. It may be due to the reason that server is overloaded or down for maintenance. This error is not inherently related to a WordPress site. It can appear on any website running on any browser or operating system.

There are a lot of possible issues causing a ‘503 service unavailable error’. They can be either related to server or the content management system(e.g WordPress). So before moving on how to fix or avoid this error; let’s see what causes it on WordPress websites:

What are the Causes of 503 Service Unavailable Error in WordPress?

There are various causes to set off a 503 service unavailable error in WordPress. Here, some of the potential ones are listed as follows:

1. Server Downtime

A web host provides a fixed amount of resource for each hosting account. If your WordPress website is on shared hosting, it may not handle excess traffic. Similarly, the users will encounter a 503 service unavailable error if the server is under maintenance.

2. Bad PHP Scripts

Another potential reason to get a 503 service unavailable error is unable to load a PHP script at server request. This script can be a WordPress theme or plugin.

3. Custom Scripts

If you have recently added a custom script to your WordPress site, this can also be the cause of returning 503 error.

4. Distributed Denial of Service(DDoS) Attacks

If your site becomes a victim of the DDoS attack and flooded with traffic, it will make your site inaccessible for some time.

How to Fix Error 503 Service Unavailable in WordPress?

As you are familiar with potential causes of getting 503 service unavailable error, let’s see how you can fix it. But before attempting any fixes or changes to the system, don’t forget to perform a full backup of your application, database, and so forth. It’s always better to play safe. The major fixes are as follows:

1. Deactivate Plugins

If the error is not server-side then the most probable cause is the use of multiple plugins simultaneously. As it leads to more incompatibility issues. So deactivating all the plugins and then enabling one by one, is an effective way to figure out which plugin crashes your site by returning this error.

But due to this error, you will not be able to access your dashboard otherwise, you can deactivate plugins from there only. So, you have to download and install an FTP client like FileZilla. This software helps you to connect and transfer files to and from your server. You will need FTP credentials for this that you can find under Setting → General section of your web host.

Using these, log into your server from FileZilla and follow these steps to disable plugins:

  • Locate and open the WordPress Root Folder generally named public_html.
  • Navigate the wp_conent folder to find plugins folder.

  • Right Click it and rename it as plugins-deactivated to remember the status of plugins.

It will deactivate all plugins, so try to access your WordPress website now.

You will be able to access if the error is generated due to the incompatibility of plugins. Return back to the wp_content folder and rename the plugins-deactivated folder to its original name. But all the plugins remain disabled by default.

You need to access WordPress Dashboard and navigate to Plugins tab. From here, activate all plugins one by one and check your site is still running. This procedure will lead you to find the faulty plugin causing the 503 service unavailable error. Once you identify it, go back to wp_content folder through FileZilla and delete the corresponding folder of this plugin.

In case, you need the functionality of that very plugin; contact its developer and ask for a fix. Till then, you can replace it with some other plugin from WordPress Repository.

2. Disable the Current WordPress Theme

If disabling plugins doesn’t work out for you to remove this error then you can fix it by disabling your current theme. This will be quite easy to implement as the procedure is quite similar to deactivation of plugins. You will do this with FTP by following the steps given below:

  • Log into your server using FTP credentials.
  • Access your WordPress root folder(public_html).
  • Navigate to wp-content/themes directory to look for a folder holding the same name as your active theme.

  • Right-click on your theme’s folder after identifying it correctly and Rename.
  • You can change its name to anything depicting that theme is disabled e.g. mytheme-deactivated.
  • Try to access your WordPress site. If you succeed, you will see the default theme activated on your site.

In this case, make sure you are using the latest version of your theme. If it is the latest one, consult the theme developer for a fix. If didn’t get a fix, you need to switch to some other theme.

3. Debug WordPress Custom Code

If the error is not fixed by disabling plugins or theme, you might need to enable the Debug Feature in WordPress. As sometimes the custom code additions cause the problems. But it’s very difficult to keep track of custom code. So, you need to enable debug feature through FTP as follows:

  • Locate the WordPress root folder via FileZilla.
  • Go to wp-config.php file and right-click it to choose the View/Edit option. It will open the file in your default text editor.

  • Now try to find the line: “That’s all, stop editing! Happy blogging near the end of the file.”
  • Add the following code above that line:
@ini_set( ‘display_errors’, 1);
  • Save the changes and close the file. Try to access your website.

You simply turn on the error display feature by adding that code. It will display the detailed error message. It will also show the specific lines causing disruptions. You can fix it by using FTP and can get the things back to normal.

Once you make the necessary changes, it is recommended to disable the debug feature due to security reasons.

4. Replace WordPress Cron Job With The Real Cron Job

You can also take some extra measures for the less utilization of server resources. Such as replacing a WordPress Cron job with some real cron job. A WordPress cron job executes every time your website is loaded. It checks for any scheduled task and executes it if available. It consumes your server resources every time. So, you can disable a WordPress cron job and add Cron job manually to execute once after a long time, say once in 20- 30 minutes. That varies server to server. You can ask for the maximum time for a Cron job execution from your host provider. To get more details about how you can schedule a cron job in WordPress exclusively, you can read our article on WordPress Cron Functions.

5. Limit WordPress heartbeat

Similarly, WordPress has a heartbeat functionality to communicate to your browser and server once you logged in. It auto-save the edits and show the notifications in the real time. It consumes extra resources to autosave your post. You can limit or completely disable it. To disable it, you can add the following code at the starting of your themes functions.php file right after <?php tag:

add_action( 'init', 'stop_heartbeat', 1 );

function stop_heartbeat() {

wp_deregister_script('heartbeat');

}

If you only want to limit, you can make use of Heartbeat Control WordPress Plugin.

6. Contact Your Web Host

If you notice an unusual traffic(DDoS attack) to your site, you need to consult your host provider to handle it. Your web host can help you out by:

  • Upgrading your plan to deal with the spike in traffic temporarily.
  • Implement some defense against the DDoS attack causing problems.
  • You can move to a better plan to handle the traffic you’re receiving efficiently.

But in case, you get the suggestion to wait until the traffic dies on its own; you should consider changer your web host.

Tips to Avoid “Error 503 Service Unavailable” in Future

Well, we have discussed the possible fixes of 503 service unavailable error. But if you are getting problems due to excessive traffic on your website; you can avoid it by following some simple things as follows:

  1. You can adopt a more suitable Host provider that can deal with more visitors. It can provide you powerful features to tackle a heavy traffic.
  2. You can use a Content Delivery Network to lessen the load on your server. As a CDN works as a mediator between you and your server. It is a server that makes copies of your website pages and serves fastly whenever needed.
  3. You can even make a try by installing a fresh copy of CMS.

To Bind Up

As of now, you know the potential causes of a 503 service unavailable error in WordPress, various ways to fix it. Usually, a beginner frustrates as unable to find the cause behind it. Here, you get the exposure to possible reasons behind this error like badly coded PHP scripts, custom scripts, server downtime, DDoS attacks etc. With these, you come to know about solutions such as disabling the themes or plugins, enabling the debug feature, limiting the WordPress heartbeat. In the end, if attempting all this will not give appropriate results; you can consult with your web host. So, it is a full-fledged guide to get rid of 503 service unavailable error.

If you want to know more about Common WordPress errors and how to remove those, you can refer our article on WordPress Errors that Frustrate You the Most.

If you want to share something, you are always welcome to post in the comment section below.