News

Home / News

Your Wordpress Site is Slow!

So, you have a Wordpress site because, well, your smart SEO guy told you it was the best to have. What this really means is that it’s the platform he/she knows how to use, but that’s another article. Now you’re wondering, “Why is my site so slow?”

Some may retort, “Because it’s Wordpress and it sucks!” But, this isn’t helpful to you, and regardless of what some believe about Wordpress, many of the page speed problems you’re probably seeing are common in other CMS systems, as well as custom programmed websites. So, while the thoughts below are written with Wordpress in mind, you can apply many of the ideas to almost any website that’s running slower than you’d like.

The first step is to find out what the problems actually are. There are a few good tools available for analyzing your page speed, but my favorites are:

Google PageSpeed Insights - https://developers.google.com/speed/pagespeed/insights/ GTMetrix - https://gtmetrix.com/

Both of these will give you a good indication of where the bottlenecks are occurring, as well as some valuable information on how to correct the problems. Of course, if you don’t manage your site and/or hosting account, you’ll be at someone else’s mercy to help with some of the problems we’ll discuss. So, let’s just run through a few things that are common problems, which you may see in your analysis:

Blocking JavaScript Files

For years, Google and other webmaster help sites have recommended putting references to JavaScript files below any content in the HTML so that the browser can begin rendering the page without waiting on the JavaScript files to be downloaded. Sometimes these files can be large, and if browser caching (discussed later) isn’t properly used, they can take a while to download and parse. If the files are loaded above the HTML content of the page, that content won’t be rendered until the JS files are downloaded and parsed by the browser. This is one of the most common problems with Wordpress, and many other CMS systems, because many of the plugins developed for those systems insert the required JS in the head of the document, which leads to blocking and slow page load times.

If at all possible, these file references should be moved to the bottom of the HTML document. If you’re using a theme and plugins that are inserting the JS at the top, perhaps sending a message to the designer or developer asking for assistance will help. Probably not, though, so you may have to hack the theme yourself or ask for assistance from another developer. WPCurve.com is a great source for Wordpress help like this.

Cheap hosting

Low cost hosting often gets a bad rep. But, sometimes it’s warranted. A Wordpress site can be a fairly good load on a server, and using the $3/month shared hosting account, which promises “unlimited everything” is probably not your best bet. The tools mentioned above will give you an indication if the server response time is part of your problem. If it is, and you’re on a cheap hosting account, sending them nasty emails isn’t going to fix your problem.

I’ve had very good luck with using cloud servers or VPS’s from Rackspace and Digital Ocean. There are other hosting providers who specialize in Wordpress sites, and they vary in price and performance. Perhaps a good review of some of these will come in a future article. However, if most of the add on features these hosting sites provide can be duplicated by using CloudFlare in front of your VPS. We’ve had very good experience running Wordpress sites on a Rackspace Cloud Server and routing the traffic through CloudFlare. Shoot us a message if you’d like more information on how to set this up.

Other things to think about regarding your hosting environment are to make sure Keep Alive and compression are enabled, as well as some other server setting that can ensure the pages are served efficiently. I’ll try to write a more in-depth server configuration and optimization article in the coming months. But, for most small sites with lighter loads, the default settings for most hosting environments will not cause a bottleneck at this level.

Bad Plugins

Wordpress, and other Open Source CMS systems are popular because of the large community of developers that build plugins, extending the basic features of the CMS to create robust web applications, in some instances. However, with this popularity comes a community of, let’s just say, less than desirable developers, who build plugins that cause less than desirable results on your site.

There are several sources of “the worst Wordpress plugins,” but much of that information is subjective, outdated, or just not useful. I’d recommend doing the following:

  • Remove any plugins you aren’t using
  • Disable all other plugins
  • Enable each plugin one at a time and test the site speed.
  • If you find a plugin causes a large increase in page load time, remove it and search for an alternative.

Beyond that, the best way to evaluate what plugin is causing problems is by viewing the transaction logs in a service like New Relic or Xhprof. The use of these tools is beyond the scope of this article, but feel free to contact us for further information or assistance with one of these advanced analytic tools.

Caching

If you have 20 images on your home page, every time someone visits your page, the browser has to make 20 calls to the server just to retrieve those images. Browsers are often fair at caching these static assets so that a local copy can be used instead of making all of those requests. However, to improve efficiency of browser caching, there are many Wordpress caching plugins available. Not only do these plugins help control how browsers manage client-side caching, but many have features which allow you to control database caching, and other server-side functions. Be sure and research these, as many of them fall under the “Bad Plugins” section mentioned above.

WP Super Cache is one of the most popular, and fairly robust. Some of the features should be tested with your site before just turning them on and ignoring things, as I’ve found that some CSS and JS aren’t compatible with the concatenation and minification functions available with this plugin. For a nice article regarding this and other plugins, check out this article from SitePoint.com.

If you’ve had your website custom programmed, ask the developer for help on setting up database query caching and other features that will speed your site up tremendously, especially if you have a high traffic site with lots of dynamic content.

Content Size

The last item I want to mention, though there may be others that are less common, is the overall size of your content. Back in the day (a few years ago) the general rule was to keep all HTML, JavaScript, CSS, images, and other assets to a limit of 500kb total. Today, with all of the video background scripts, large images, high-resolution images to be shown on retina displays, and heavy JavaScript use, a 500kb site is hard to come by. But, the good news is that a site can be about 3 times that large, and still offer a good user experience, because of the improved speed of WiFi connections, etc. Still, keep the site below 1.5MB can prove to be a challenge with some of the themes available, as designers work hard to make their themes more and more robust.

To reduce content size, follow some of these guidelines:

  1. Try to optimize images and reduce their size to the smallest that still look good in the browser.
  2. Remove duplicate JavaScript (You may be surprised how many times JQuery may be called in a single site if poor coding is done).
  3. Remove any unused JavaScript and CSS - many times your theme will come with some features that you aren’t using, and the JS and CSS files with manage those features are likely in separate files. For instance, if you aren’t using the carousel widget that came with you theme, you can probably remove the javascript and css that drives that widget from the HTML with no problems.
  4. Concatenate and minify remaining JS and CSS. Use tools like CodeKit to combine the JS files and CSS files so that the overall size and number or required server requests is reduced.
  5. If you have a video or large image background, it’s likely you can reduce the resolution, and therefore the file size, of that file without a noticeable difference. This is especially true when the background has an overlay on it, which is often the case in landing page slideshows and such.
  6. Minify your HTML. This is likely overkill, and will give you minimal improvement. Personally, I don’t believe the advantages in speed make up for the difficulties you create in maintenance and updates of the site, but some will recommend it.

There are many other tricks of the trade, all with varying degrees of results. But, I’ve found the items mentioned above should give you a good start on improving the speed of your site. If you need assistance or have any questions, feel free to drop us a line. We’re always here to help.

Posted on Aug 19, 2015