Problem description
- Your website is normally very fast to load, but suddenly or recently it takes 10+ seconds to load a single page (which could result in an error at the end, or the page loading normally).
- Your website is loading slowly.
- WordPress is slow.
- It might take 30-60 seconds to finish loading and then either load the page or result in a timeout error or gateway error
Note: For the purposes of this article, when we say slow, we don't mean for all resources to load on the page, rather there's no sign of the site loading at all in the browser until at least 8-10 seconds of waiting.
Problem Resolution
There's a few reasons this issue can occur. Here's the list along with their solutions:
- The server as a whole OR only your website is under heavy load. In this case the page will load, just a bit slower than usual. Wait 5-10 minutes and check the results again. This is expected, to a certain degree, under shared web hosting environments. If you have a dedicated server, I'd suggest getting in touch with whomever is managing your server to find out why there is/was a temporary slowdown.
- You're using PHP version 5.x still: See our guide here to changing the PHP version.
- Your theme is configured to allow full theme-resource processing on 404 pages: See the part about "Any Theme's Custom 404.php" in our discouraged WordPress plugins and themes article for a solution to this issue.
- There is code where there shouldn't be code: Check the index.php file and (for WordPress) wp-config.php file to see if there's any code that shouldn't be there. That code is likely trying to access a resources at a URL that it cannot reach. We have occasionally seen this with malicious code injected into the top of index.php.
- Some piece of code is running for as long as the PHP process is allowed to live, then failing either silently or with a Gateway error:
If the page finally loads, you can inspect the page for glitches or missing elements. For example if the problem is with a Twitter widget, you might find that the Twitter widget never loads on the page like it should. Then you can go specifically to that plugin and disable it to solve the problem without having to scan through each of your plugins one-by-one.
If the page never loads and instead you get a Gateway or timeout error, you'll need to follow our guide to troubleshooting Gateway errors here.