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.
Locate your active theme and download it as shown below:
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 WP_DEBUG and WP_DEBUG_LOG, WP_DEBUG_DISPLAY and @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