With internet connections getting faster and faster every year, you would expect that optimizing the speed of your website would become less of a priority. That is not the case.
If your website does not load within a few seconds, most people will simply lose interest. In 2009 almost 50% of people polled for a survey expected a website to load in 2 seconds or less. For an eCommerce website, that can mean lost sales, return customers, and overall revenue. For a blog, that could mean losing a loyal reader who might have shared your content, or subscribed to your list.
Search engines have been heavily pushing for more lightweight websites over the last few years. Google has gone so far as to rank fast loading websites higher than slow loading sites. This has helped put website optimization firmly back in the limelight.
If you want to go from this:
Keep on reading, and I’ll show you exactly how you can get similar results.
This how-to-guide will show you how to improve your WordPress Site’s speed from long, customer-scaring load times of over 3-4 seconds, to 2, 1 or even load times of under a second. (This is what I experienced when I used just some of the steps outlined here on one of my websites.)
WordPress Site Speed Guide for 2015
Before you apply any of the suggestions detailed in this article, you should test the speed of your website using a site speed testing service such as GTMetrix, Pingdom Tools. or Google PageSpeed. Take a note of your page size, http requests and load time(or take a screenshot) and then run a test again after you have modified your website. This will give you a clear understanding of how your website speed has improved.
I like to test with both GTMetrix and Pindom Tools, just in case one of them futzes up the results. You’ve already seen my before benchmark from Pingdom, and my GTMetrix benchmark looked like this:
1. Choose Your Host Wisely and Get Your site to Load under 1.5 seconds
For many this would be the last resort options for improving site loading speed, as it probably should be given how huge of a difference on-page optimization can make. But the fact of the matter is, not all hosts are created equal, and hosting packages are definitely not.
Most WordPress sites start out on quite humble hosting packages on budget webhosts. Which is not necessarily bad at the time, when you’re not really getting many visitors or using the website to bring in business. But a lot of these budget packages basically boil down to maybe a small percentage of an outdated server, which can put a dampener on your site speed no matter how much you optimize the actual site.
- How to Choose the Best WordPress Hosting For Your New Website
- What is Managed WordPress Hosting? Pros, Cons, and More
Even if you use a CDN effectively, if your website takes over a second to get to the point where it’s even calling on the CDN for the media and other elements, it’s always gonna be slower than it has to be. If you’ve improved all elements mentioned here except for the host and your loading time is still longer than 2 seconds, the core problem might be your host. If your website is business oriented, and brings in a fair amount of customers, you might want to change hosts or plans at this point.
The ‘wait’ for your website is how long it takes to contact the server the first time, before it even tells the browser anything. And this wait can depend greatly depending on how overworked your servers are. For example, if you’re on shared hosting, you could be unlucky, and share your server with people who use a lot of the memory. This can turn into extraordinary load times during peak hours. (In the past, I’ve seen variations from three, all the way up to nine seconds depending on the time of day.)
If your own website is heavily trafficked, and none of the other steps in this guide seem to improve your site speed to under 2-3 seconds, you might need to change hosts.
If not, and your shared hosting seems quite stable, this is probably not going to be your biggest win, unless you’ve already optimized your site as much as you can without actually upgrading.
But it is definitely worth looking into. After all, most worthwhile CDNs cost money, and a better host could be enough if you mostly have a region specific audience. For lightning fast hosting, as well as hands-on help to migrate and optimize your site, we recommend WP Engine (our review).
Go with WPEngine, as they have been in the market for a long time and provide great customer support. and never had any problem. Their infrastructure include staging area, HHVM support, CDN integration, improved security, daily backups, and EverCache caching technology for massive scalability and speed.
2. Choose Your Theme Wisely
Another thing that is a little more labor-intensive and stressful, but at times necessary to increase the speed of your website, is to change your theme. Now for this to be worth doing, you will have to be using a very clunky, overweight theme that drags in a lot of outside elements, creating an overload of http requests. The real problem is that many themes fall into this category.
If your theme animates stuff unnecessarily, or forces you to show giant sliders at the top of every page, or if the list of it’s functions and suitable websites is longer than two A4 pages, this is often a safe indicator that your theme is a little on the clunky side.
If you’re considering changing themes, I would recommend that you test your theme demo site, on Pingdom Tools or GTmetrix, and compare the feedback towards possible substitutions that are simpler and prioritize speed. Because of the possible differences in server loading speed for the demos, don’t look at the loading times, but focus on the number of requests and maybe also the page size.
Now keep in mind that Airship and One Touch show many more elements on their demo pages than Genesis, but if you look at the individual requests, you will see several outside scripts and stylesheets. Sure this can be optimized through a caching plugin, but you can’t completely delete the effect it will have on your loading speeds. I’m sure if you opted to use less of One Touche’s functionality it would show a lot fewer requests, but the option to put sliders and other aesthetically pleasing little things on the homepage might be tempting for many.
This is easy to test, but it’s always hard to get another theme to look right without hands-on experience. So when you find a lighter theme that you like, you should set up a local/other development installation of your site, and then you can prepare all the necessary tweaks to make it instantly look good and retain functionality when you eventually change the theme on your live site.
In the past, surprisingly few theme authors went to lengths to eliminate excess code, and keep http requests as low as possible, perhaps they got a little caught up in functionality and design. But these days, with an increasing focus on loading speed, it’s becoming more and more common to optimize for speed.
If your project requires extensive functionality and you get it from a relatively lean theme, or from specific plugins, fear not. You can keep page builders, and other useful functionality and not sacrifice too much on speed, as long as the CSS and JS is tidy, and you have properly configured caching.
Never ever use multi-purpose themes, of course, there are some exceptions, but generally multi-purpose themes tend to be bloated. Go with themes that are designed to solve a specific purpose. Here at WPKube, we are using Genesis Framework, which comes with some great features and minimal design.
3. Optimize Your Homepage to Increase conversation rate and Reduce Bounce Rate
Delivering a static home page can be a great idea, not only for site speed purposes, but for conversions as well. For example, if you have an about page, or a start-here page, or a landing page, you can modify it a little and easily set it as your home page through the theme customizer.
But if you don’t want to go through the hassle, or you simply don’t know what to put on one, a must do is to set your maximum number of posts shown on the home page to 4-6.
You should also either show excerpts, or manually insert ‘more tags’ in your posts, especially if you have multiple images in many of your posts. This can drastically reduce load times in itself, but if you have a lot of traffic it will also reduce the load on your server, which will most likely make your load times even faster.
4. Remove Unnecessary Plugins
Plugins are the reason why the WordPress platform is so flexible. Unfortunately, plugins are also one of the main reasons WordPress websites are slow. Every plugin you activate adds weight to your website. Even basic plugins with little functionality can slow down your website considerably if they are poorly coded. This has led many WordPress hosting companies to disallow problematic plugins from being used by customers.
There are a number of ways in which a plugin can slow down your website:
- Increasing the Size of Your Database – The additional data that plugins store take up a lot of space in your database. Certain types of plugins, such as statistical plugins, are known for adding hundreds or even thousands of new rows to your website database. As a result, your pages take longer to load.
- Persistent Requests to Your Database & Server – Constant requests to your database can put a lot of strain on your server’s CPU. This can increase the risk CPU throttling and have a detrimental effect on performance.
- Calls to External Services – It is difficult to optimize a web page that makes excessive calls to external services. Social media sharing buttons, for example, can slow down your web page by half a second or more.
It is therefore imperative that you deactivate and delete any WordPress plugins that are not vital to your website’s success. Do not fall into the habit of leaving plugins activated because you might use them again in the future. If a plugin is important, keep it activated. If it is not, uninstall the plugin. You can always reinstall the plugin at a later date.
If you want a better idea of which plugins are increasing your page loading times, I recommend using the P3 (Plugin Performance Profiler) by GoDaddy. The plugin will review every plugin you have activated and detail how much time it adds to your page loading time.
Some people feel that the performance profiler is not accurate enough, and prefer simply enabling/disabling one plugin at a time, and testing the resulting differences in speed using the tools mentioned above.
5. Reduce the Weight of Your Images
Modern website designs are generally quicker than the table based designs that were used years ago. Designers now use CSS to style their designs instead of tables and images.
While website designs have got lighter, the number of images that are being used within the content area has significantly increased. It is not uncommon for articles nowadays to include dozens of photographs. As each image increases the file size of the web page, your page loading time also increases.
There are a number of ways that you can reduce the weight that images add:
- Split long posts with images into multiple pages using the nextpage option.
- Decrease the file size of your images by optimizing your images before uploading. Most graphic editing programs have the option to do this built-in, however there are many stand-alone image optimization applications available such as ImageOptim and RIOT.
- Alternatively, you can reduce the file size of your images after uploading them by using a plugin such as WP-Smush.it, EWWW Image Optimizer, or Hammy.
Reducing the size of your images also has the benefit of reducing the amount of disk space your images use on your server.
Another important point, is to only upload images that fit (or at least are close) the actual dimensions you use on your website. The appropriate size depends on how wide the content section of your blog is, which depends on whether or not you use a full-width theme, so you’ll have to find out for yourself what the appropriate with is.
If you don’t know where to find this width in the CSS code itself, you can simply measure it out in with this online tool.
6. Utilize Lazy Load
Lazy load basically stops a browser from loading images, or other bandwidth heavy elements such as iFrames, until the browser actually scrolls down to where they are. This means even if you have 10 pictures on your homepage, as long as only 2 are visible to the user when he is first loading your page, they are the only pictures that will be loaded, significantly decreasing page size and load times.
I personally use and recommend the BJ Lazy Load plugin. Setting it up is as easy as it gets. Install, and activate.
7. Optimize Your Database
The default configuration of WordPress is not efficient. It keeps a lot of unnecessary information that needlessly inflates the size of your database by retaining spam comments, trash items and excessive post revisions.
Post revisions are one of the main reasons WordPress databases grow too big. In addition to storing an autosave, WordPress will keep a copy of every draft you have ever saved for your posts and pages. It is one of my favorite features as it protects you against lost internet connections and allows you to refer to older drafts.
Unfortunately, beyond a few drafts, post revisions can be wasteful as WordPress does not limit the number of revisions that are saved. Therefore, if you saved your article fifty times, there would be fifty drafts saved in your website database. This takes up the same amount of storage in your database as fifty published posts with no revisions.
Thankfully, WordPress allows you to limit the number of post revisions that are saved. All you need to do is add a line of code to your wp-config.php file.
define( 'WP_POST_REVISIONS', 3 );
Note that any additional post revisions will automatically replace older versions.
I personally feel that three revisions is sufficient; however many website owners reduce this to just one. You can also disable post revisions completely by changing the value in the above code to “0” or “false”. If you are not comfortable editing your wp-config.php file, I recommend using a plugin such as Simple Revision Control instead.
Another thing you may want to consider is reducing the length of time items are kept in trash. Whenever you delete an entry through your WordPress admin area, whether a post, page, or comment; WordPress will move the item to trash. This is a failsafe system that allows you to restore any items that were accidentally deleted.
By default, WordPress will automatically delete items that have been in trash after thirty days. This can be reduced by adding the following line to your wp-config.php file:
A great plugin for optimizing your database is Optimize Database after Deleting Revisions. It allows you to delete post revisions, spam comments, unused tags and more. Another plugin to checkout is Plugins Garbage Collector. The plugin will scan your database and remove any junk that deactivated plugins forgot to remove.
8. Enable Website Caching
Caching plugins allow you to generate static HTML files of your pages and display them to visitors. Utilizing caching can have a major improvement on your page loading times as the number of requests to your server drops considerably.
There are many great caching plugins available for WordPress. By far the most popular are W3 Total Cache and WP Super Cache. For this guide, you should go with W3 Total Cache, as it makes implementing a CDN(content delivery network) a lot easier later on.
You can read more about how to set up W3 Total Cache (with MaxCDN) here.
Most managed hosting services come with their own caching solution, so if you are hosting your site on Managed hosting environment, you won’t have to install caching plugin.
9. Use a Content Delivery Network (CDN)
Every time you visit a website, your computer has to download files from the server that the website is hosted on. The time that it takes for this information to be received is known as the response time; and it can be one of the biggest reasons a website loads slowly.
Response times can be as much as half a second. When you add in the total file size of a web page, the overall time a page takes to load can add up to be several seconds.
The further you get away from where your website is hosted, the higher your response time will be. For example, if your data center is located in New York, a visitor from Texas will get a better response time than someone who is situated in Moscow. The best way to resolve this situation is to take advantage of a Content Delivery Network.
Content Delivery Networks take a copy of your files and store it in one of their many data centers around the world. Instead of downloading a copy of your files directly from your server, visitors will automatically download a copy from a data center that is near to them. This ensures that all visitors will get fast loading times while viewing your website.
There are several major players in the CDN market. I personally recommend MaxCDN. MaxCDN is used by huge websites such as Nissan and StumbleUpon. They also have peering partners in a total of ninety countries.
Content Delivery Network’s are not free, however please bear in mind that your hosting costs will be reduced significantly by a Content Delivery Network as they handle the majority of your bandwidth. What’s good about MaxCDN is that they have great pricing and reliable service.
If you decide to go with MaxCDN, use coupon code “wpkube25” for 25% off.
And again, you can read more about how to set up W3 Total Cache (with MaxCDN) here.
10. Protect Yourself From Hotlinking, Brute-Force Attacks, And Spam-bots
Hotlinking is when somebody uses your image on their website. Basically, their making your server do the brunt of the work on their pages.
Brute-force attacks is basically when someone has set up a script or program to repeatedly try to login to your admin area. Just trying infinite variations on password with a few different usernames the attacker thinks might be yours.
There are many plugins that can help you with this, but one of the most versatile is All-in-one WP Security and Firewall.
- To protect yourself from brute-force attacks use the login lockdown feature. This makes it so that when someone from a particular IP adress fails to login successfully too many times, they get blocked from accessing the login page.
- You should also move the url of your login-page so that only you will know where to find it. This will serve up a 404 error page, stopping scripts from pinging your database and server non-stop.
- If you never access your WordPress site except from home and from work, you can use the whitelist function to whitelist only your work and home IPs. This will mean that only people with the same IP as your workplace or home will be able to see the login page and login to the admin area. If you don’t know your IP, you can simply ask Google what your IP is. (Beginners should be careful with this option, because they might find themselves locked out of their own admin area, unable to reverse what has been done without outside help.)
- Something that will protect you from both brute-force attacks and spammers, is enabling the ‘5G Blacklist firewall rules’. Another thing that will help to stop spambots is forbidding comment posting.
- And lastly, disable hotlinking to keep people from serving your pictures from your server on their website.
You can also use CloudFlare to help combat the brute-force attacks and spam-bots.
Test and Share Your Results
I hope you have enjoyed this look into how you can improve the speed of your WordPress website. I have touched upon what I consider to be the biggest factors that impact page loading times. Don’t forget to test your speed again using Pingdom Tools or GTMetrix.
My final results according to GTMetrix:
Did you try any of the steps outlined here? What were your results in loading speed improvement? What steps do you take to optimize your WordPress websites? Please feel free to drop us a line in the comment area :).
Note: This post was originally written by Kevin Muldoon and later modified by