503 error WordPress.

Have you encountered the 503 error on your WordPress site? It’s a common WordPress error that can be fixed by following the steps we have covered in today’s tutorial.

In this article, we will first discuss what caused the 503 error in WordPress, then we will show you all potential solutions and how you can prevent encountering the 503 error in the future.

Let’s dive in! 🏄

Key Takeaways

  • Plugins can often cause 503 errors, so disabling them can help identify the culprit.
  • If plugins aren’t the issue, try switching up your theme to something basic and see if that clears the error.
  • Check if your CDN is playing nice. Pausing it could quickly get your site back online.
  • Limit the WordPress Heartbeat API. It’s great, but too much of a good thing can cause errors.
  • Turn on WP_DEBUG to pinpoint the specific issue causing the 503 error.

📚 Table of contents:

How to fix the 503 error (WordPress)

The exact fix that is going to work for you depends on the root cause. The 503 error itself does not give you much information to go on. So in this section, we will show you a number of steps to follow in order to pinpoint the cause and then fix it.

Before we dive into the solutions, make sure you are carrying out the following preliminary steps:

The 503 error WordPress also occurs when you are updating a plugin or a theme. You might want to check your website again to see if it was a temporary issue. Just make sure you cleared the cache before checking the site.

As I mentioned earlier, sometimes the 503 error occurs because of maintenance work on your web server. You must have been alerted about it via email by your hosting provider. In a typical maintenance alert, you are informed about how long the server is expected to be down. So check your email.

bluehost scheduled maintenance email
Bluehost scheduled maintenance email

If the error appeared right after you added a code snippet to your website, then you know who the culprit is. Remove the code and your website should go back to normal. But if you’ve lost access to your dashboard, then we suggest restoring a backup of your website. Your hosting provider should be able to help you out with this.

Nothing worked? Then let’s try the steps below. 👇

1. Deactivate plugins temporarily

503 errors are commonly caused by plugins that you have installed on your site. To determine if a plugin caused the error, you will need to disable all the plugins only temporarily.

The 503 error prevents you from accessing the dashboard, so you will have to use an FTP client like FileZilla.

Open FileZilla, connect with your site, and navigate to the public_html directory. Open the folder and navigate to the wp-content. Inside this directory, you’ll find another one called plugins. It contains all your site’s plugins (active and inactive). Rename the plugins directory to plugins_ or whatever else. This will deactivate every plugin on your site.

editing plugins folder
Disabling all plugins by renaming the main plugin directory

Go back to your site again and see if the 503 error is gone. If it is, then it’s safe to assume that a plugin was causing the error.

Now, it’s time to pinpoint the exact plugin that’s causing the issues.

Go back to FileZilla, change back the name of your plugins directory to the original (“plugins”). Go inside and start working through all your plugins one by one. Do this:

  1. Change the name of the first plugin in the directory to something else.
  2. Check the website to see if the error is gone.
  3. If it is indeed gone, you’ve found your culprit. If not, change back the name of that first plugin and proceed to test the next one the same way.
  4. Repeat until you find the plugin that’s causing the problems.

Once you find the plugin causing the error, it’s best to just delete it and look for an alternative. If none of your plugins is causing the 503 error, then try the next solution.

2. Deactivate your theme temporarily

Deactivating the theme is a bit tricky because you can’t simply rename the theme folder as we did with the plugins folder. It would lead to an error of its own.

So here’s what you need to do: log into your hosting account, go to the cPanel section and open the phpMyAdmin.

Select wp_options and go to Search. Under option_name, write template and click on Go.

changing wordpress theme in phpmyadmin
Finding your current theme in PHPMyAdmin

The system will run a search and then show you your current theme under option_value. Select Edit and change the current theme to twentytwentyone.

editing option value in phpmyadmin
Editing current theme in PHPMyAdmin

If this fixes the error, then you might want to try getting an earlier version of the theme (one that worked), installing it, and waiting for the theme’s developer to release an update. Or, you can switch to a different theme altogether if that’s an option.

3. Disable your CDN temporarily

Occasionally, CDNs are known to cause 503 errors, so disabling it – if you have one working on your site – can be a quick solution. All CDNs have some option that allows you to pause them manually. For instance, on Cloudflare, you need to log into your account, select your website, and click on the Pause Cloudflare on site option.

Next, check your website and if the 503 error persists, then unpause the CDN and try the next solution.

4. Limit WordPress Heartbeat API

The Heartbeat API is responsible for several essential functions, like auto-saving posts, showing plugin notifications, preventing you from accessing a post when someone else is modifying it, etc.

The API uses your server resources to carry out these functions. If your server can’t handle the API’s demands, it will throw a 503 error. To determine if the Heartbeat API is causing the error, you need to disable it temporarily.

Open your FTP client (FileZilla), connect to your website and go to public_html → wp-content → themes. Open the current theme directory and download a copy of the functions.php file, then edit it.

function.php file location -  503 error fix
Locating function.php file

Add the following code snippet right after the opening <?php tag:

add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
editing function.php file to fix 503 error
Inserting code snippet in function.php file

Save the file, reupload it, and check your website. If the error disappears, then you’ve caught the culprit.

But remember, the Heartbeat API is essential, so you can’t keep it disabled long term. You can slow down its frequency if you feel like it by installing the Heartbeat control plugin. Just make sure to delete the code snippet from the functions.php file before setting up the plugin.

5. Enable WP_DEBUG

When all other solutions fail, enabling the debug mode could give you answers.

You can enable the debug mode using a plugin or by modifying the wp-config file.

Since the 503 error prevents you from accessing the dashboard, installing a plugin is out of the question. So you have to modify the wp-config file manually.

Open your FTP client (FileZilla), go to public_html → wp-config.php and download a copy of the file, then edit it. Insert the following code snippet into it:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Save the file and reupload it.

editing wpconfig file to fix 503 error
Inserting code snippet in wp-config.php file

Now go to the wp-content directory, and you should find a debug.log file in there.

The log file contains errors that your website has been experiencing. It’ll show you the causes of the error along with specific lines of code that led to it. You are not going to find a direct indication of the 503 error, so we suggest showing the log to your hosting provider and seeking help with them.

👉 By now, you should have a solution to the 503 WordPress error. However, you should ensure that it never occurs on your site in the future again.

What is the 503 error? What causes it?

The 503 error occurs when your website server cannot be reached – i.e., the server is unavailable. The reasons for unavailability can be a badly coded plugin or theme, a code snippet gone rogue, a glitch in the server, a DDoS attack, or quality issues with your hosting service overall.

🔎 Let’s take a deeper look at each of the causes:

Badly coded plugin or theme

Commonly, the 503 error appears when you install or update a badly coded plugin or theme. When the plugin or theme cannot function properly, it causes WordPress to throw the 503 error.

Code snippet gone rogue

Customizing a WordPress site is super easy. You can add some CSS code here, upload a PHP script there, and modify the site based on your needs. But, a piece of bad custom code can cause a lot of trouble. The 503 error you are experiencing could be due to such a bad code snippet.

Bad web hosting setup

We all love shared hosting services because of the affordability factor, but rarely do we consider the downsides of such setups. Hosting your website with other unknown websites on the same server means any of the websites can end up overusing the server’s resources. Your website may have been deprived of its resources, which caused the 503 errors.

Technical issues of the server

Your server could be down because it’s under maintenance, or because of some other scheduled work. Usually, any issues resulting from these reasons disappear after a couple of hours. That said, hosting providers should have mirror servers to ensure that the sites are up and running during maintenance.

A DDoS attack

Although this does not happen very frequently, the 503 error might have been produced due to an attack made on your website. DDoS attacks, in particular, are often associated with 503 errors. That’s because, in these types of attacks, hackers send a ton of traffic to your website so that the server gets overloaded and crashes your site. Read more about DDoS attacks on WordPress sites and how to mitigate the risk here.

These are the typical reasons that cause the 503 error on WordPress sites.

It’s worth noting that there are a few different variations of the error:

  • “503 Service Unavailable”
  • “503 Service Temporarily Unavailable”
  • “HTTP Server Error 503”
  • “HTTP Error 503”
  • “Error 503 Service Unavailable”
  • “The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.”

👉 The solutions that we have covered below should fix any 503 error on a WordPress website.

Preventing 503 error WordPress in the future

You can prevent the 503 error from appearing on your website by following the instructions below:

  • Use themes and plugins from the WordPress repository or trusted developers (like Themeisle). Read how to choose a theme and how to choose a plugin for more information.
  • Move to a better hosting plan if your site requires more resources to function properly.
  • Use a firewall to prevent DDoS attacks.
  • Install or update plugins on a staging site before carrying them out on the live site.

That’s it folks! 🤩 With that, we have come to the end of this article.

I hope that you found this guide easy to follow and helpful. If you have any questions, let us know in the comments below.

Yay! 🎉 You made it to the end of the article!

Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!