Help! Pages on my website are taking 20+ seconds to load Print

  • 0

Problem description

  • Your website is normally very fast to load, but suddenly or recently it takes 20+ 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.
This could mean:

  1. Your web host is under heavy load. If this is true, then simply wait it out for 10-30 minutes and check the results again later.
  2. You're using an old version of PHP
  3. Your theme is configured to allow full theme-resource processing on 404 pages
  4. Some unknown resource on your website is loading for as long as the PHP process is allowed to live, then failing either silently or with an error

Problem Resolution

Solution For 1: This issue is pretty common and should be 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.

Solution For 2: The second issue can be remedied pretty easily within Plesk; see our guide here to changing the PHP version.

Solution For 3: See the part about "Any Theme's Custom 404.php" in our discouraged WordPress plugins and themes article for a solution to this issue.

Solution For 4: The third issue needs a bit of sleuthing. There's two ways to go about finding the source of this problem: exhaustive and a specific search. You may find that the specific search fails, in which case you'll have to fall back to exhaustive. Below covers each of these methods:

Specific Search Problem Solving with WordPress

This is a tad more difficult, but often when there are issues with a plugin or theme, after 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 you are unable to spot any glitches, you'll have to fall back to the exhaustive search option below.

Exhaustive Search Problem Solving with WordPress

To troubleshoot this exhaustively (and you'll soon realize why it's called that), disable each plugin that's active on your site one-by-one until the site begins loading normally again. The last plugin to be disabled will be the source of the problem. You can then re-enable all other plugins and request help from the developer of the plugin that you identified as causing the slow speeds. If you are unable to access the WordPress admin area to disable the plugin, you can still disable the plugin forcefully by renaming its folder using the Plesk File Manager.

Theme: If deactivating all plugins does not resolve the issue, you will likely need to activate another theme, even if just temporarily, to figure out if the theme code is to blame. If changing themes fixes the problem, then you should request help from the theme developer, or if you have had customizations completed to the theme that might be to blame, talk to the developer that created those customizations.

If a plugin or theme: why did it behave this way?

There's usually only a few potential causes for this kind of slow behaviour:

  1. Some updated code in the plugin or theme causes a spinlock -- basically a loop in the code where it's endlessly processing and never coming up with a result.
  2. The code is simply inefficient (poorly written) or incompatible with something that updated recently like a new WordPress core release, or another plugin or your theme.
  3. Something in the plugin is trying to access resources that are blocked or unavailable and doesn't have a sane timeout value set (such as 5 seconds max load time). Examples:
    1. The software is trying to open a port that is blocked. This occurs when trying to communicate with a payment processor or other third party service.
    2. The software is trying to communicate with a server that is unavailable. This has occurred in the past when services that are expected to always be operational are down, like when Twitter goes offline for a few hours and your site is attempting to load your Twitter feed.
To prevent this from occurring again, you will need to reach out to the plugin developer and indicate to them what happened. If the issue was #2, then you should then suggest that they include a more reasonable timeout value in their code and/or better error correction. If the issue was #1, they'll have to investigate further to find the source of the problem.

Was this answer helpful?

← Back