How to Fix the Wordprerss HTTP Error 503 Service Unavailable
Wordprerss HTTP Error 503 Service Unavailable indicates that your website is now inaccessible due to the server in question being unavailable. This could be due to a high volume of traffic, maintenance, or something else that necessitates a more thorough investigation.
This timeout is usually so brief that no one notices it. However, if the 503 error persists, you’ll have a far bigger problem on your hands. After all, not only will your site’s visitors be unable to view it, but you’ll also lose access to your WordPress admin area.
Fix 1 : Enable WP_DEBUG
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
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.
Fix 2 : Deactivate Your WordPress Plugins
Plugin compatibility difficulties are one of the most typical causes of the 503 error in WordPress. You’ll need to disable all of your site’s plugins to see whether that’s what’s going on.
Navigate to your WordPress root folder. In case you can’t find it, it’s usually called public_html, html, public, www, or your site’s name.
Navigate to the wp-content directory in that folder. Within the plugins folder, you’ll find distinct subdirectories for each of the plugins installed on your site. What you’re going to do now is right-click on the plugins folder, and rename it to something else. We recommend plugins.old or plugins.deactivated, so you can easily recognize it later.
WordPress will be unable to locate any of your plugins at this time. When this happens, the plugins will be disabled automatically.
Now go to your WordPress dashboard and log in. If the 503 error has vanished, it’s likely that one of your plugins was to blame. All you have to do now is figure out who is to blame.
Return to the wp-content directory, and rename your original plugins folder correctly. Then, you’ll need to disable each of your plugins one by one, until you find the culprit.
Fix 3 : Deactivate Your WordPress Theme
You’ll need to use an FTP client or cPanel’s File Manager to connect to your WordPress site. Go to the /wp-content/themes/ folder once you’ve connected.
Find your active WordPress theme and save a copy to your computer as a backup.
After you’ve downloaded your theme, you can remove it from your website.
If you already have a default theme loaded, such as Twenty Seventeen or Twenty Sixteen, it will be activated immediately. You can install a default theme on your website if you don’t have one.
Fix 4 : Temporarily Disable Your Content Delivery Network (CDN)
The 503 error may appear due to a fault with your Content Delivery Network rather than a problem with your website (CDN). If you’re utilising a CDN, temporarily turning it off can help you figure out if this is the case.
The process you need to follow may be different depending on which CDN you’re using. Cloudflare has also been known to cause 503 errors sometimes. If you can’t find the option to pause yours, check out your service’s knowledge base, which will usually contain detailed instructions.
Fix 5 : Limit WordPress Heartbeat
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.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 <?php
tag:
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 below code didn’t fix the 503 error, don’t forget to remove the code from your functions.php file.
add_action( ‘init’, ‘stop_heartbeat’, 1 ); |
function stop_heartbeat() { |
wp_deregister_script(‘heartbeat’); |
} |
Upgrade to a Better Hosting Plan
Because WordPress is one of the most widely used content management systems (CMS), it is a popular target for hackers. Many malevolent people take use of these common wordpress security flaws to take control of many websites when a security hole is discovered in a plugin or at the core level.
With better security in Host & Protect’s Managed WordPress Hosting plans (Recommended), you can sleep soundly knowing that security updates, backups, and protection against WordPress brute force assaults and WordPress DDoS attacks are all taken care of.