How to make WordPress sites load faster

A slow website can frustrate and deter your visitors, it can also impact on your search engine rankings. How fast your website loads is an essential part of search engine optimization.

Google gives preference to websites that load quickly and can penalize those that are slow so its essential to have a website with good performance. WordPress is currently one of the most popular blogging/CMS applications in use on internet. Here are some ideas for optimizing WordPress and reducing the CPU and resource consumption of your website.

Note that several of these tips apply beyond WordPress.

1. Test your current website loading speeds

The first step in the optimization process should be to test your current website loading speed, so you can assess your site’s performance as it is, right now. Use GT Metrix to get your base reading. Its important to note that the tests are done for individual pages, not entire websites.

2. Choose reliable web hosting provider

This is often overlooked but web hosting is one of the key components of every successful website. There are many options out there such as shared hosting, VPS, Dedicated servers, and even managed WordPress hosting but how do you know which is the best option for you?

With so many WordPress web hosting companies and tons of fake web hosting review sites, choosing the best hosting can be hard. Here are couple of tips to help you choose the right web hosting provider for you:

Know your own hosting needs – think thoroughly on your own needs: What kind of website are you building personal or business? Do you need a special version of software (ie. PHP5)? What kind of storage do you need?

Research your (potential) host’s uptime record – If you’re running or planning to set up mission-critical sites (such as an eCommerce site), one of key issues that you also need to consider (aside from security) when looking for a web host is uptime. Nothing is more important than having a 24×7 operating web host. You need a web host that is operating on a powerful servers and stable network connections. 99.5% and above is the recommended uptime score; anything below 99% is unacceptable.

Look into specialized hosting solutions for your CMS platform – When you’re hosting WordPress sites it’s a good idea to go with a specialist WordPress host as they’ll have already optimized their infrastructure towards WordPress.

Consider where to locate your server – the best location will depend on the quality of the hosting providers available, their connection to the global communications network and the proximity to your target markets. You should also briefly consider the legal, political and environmental risks.

Scalability and space bandwidth – Different web hosting service providers different levels of space and scalability. This is important because a limited space and scalability service will render your efforts useless if you go beyond the limits of the web hosts.

Technical reliability – A good web hosting provider provides their clients and customers with technical features that include quick retrieval of lost or corrupted data and information, information and data back up and uptime percentage. As such, avoid web hosting services that only promise fast bandwidth but not technical reliability.

Be cautious when choosing shared hosting plans – The biggest catch with shared hosting is the word “unlimited”. Most shared hosting companies boast unlimited disk space, unlimited bandwidth, etc. But in reality, there is no such thing as unlimited.

Technical support – Technical support is a very important aspect of web hosting services. Without it, clients and customers will be clueless as to how to solve problems regarding their business web or blog site. Find out about the quality and convenience of technical support that is provided before selecting a web hosting plan.

Consider what type of web server to run – Consider changing the web server if things get slow for example if you are on Apache try switching to Nginx. Nginx performs excellent while using few resources. For many websites, a migration to Nginx would improve performance but also consider other web servers do you own research.

3. Use fast and lightweight theme

A fast and lightweight theme can do wonders for improving your page speed and ensuring your visitors will stay longer at your site. There are thousands of WordPress themes to pick from. Find a theme coded by an experienced WordPress developer.

It is important to note that most theme developers optimize their theme demo website using caching and content delivery networks. This makes is difficult to know how quick a WordPress theme is, before you use it yourself download it and do your own tests on your web server.

4. Remove slow / unused plugins

WordPress plugin is a program that extends the core functionality of the Content Management System (CMS). The development of plugins began because programmers wanted to increase WordPress’s functionality without altering its core structure. Every plugin adds a bit more complexity to your site, it’s important to install well-developed plugins from a reputable source.

Some folks will tell you that “running fewer plugins on your WordPress site will make your site faster,” that’s not 100% true. Sometimes a single plugin can make all the difference in page load time because it loads too many scripts, or hits the database with large number of requests. To find out which plugins are causing a slow performance on your WordPress site try P3 (Plugin Performance Profiler).

5. Optimize your images for the web

Many designers fail to compress their images before uploading them to the web, and the overall impact of this can be dramatic with image-intensive designs that will slow your site.

It is therefore in your best interests to optimize your images for the internet before you upload them to your website.

A good popular plugin to optimize images that have already been uploaded is WP Smush.it. Another good popular WordPress plugin that will automatically and losslessly optimize your images as you upload them to your blog is EWWW Image Optimizer.

6. Combine and compress HTML, CSS, and JavaScript

Remove all white space from code when possible before serving it to visitors. Each call to your CSS and Javascript files is an HTTP request. This means that when someone visits your web page, their computer sends a request for a file and then the server sends it back. The more requests there are to your server, the longer it will take for your pages to load.

Minifying combines multiple CSS and Javascript files into a single file. This greatly reduces the number of HTTP requests. The application also removes unnecessary white space and comments. There are a number of WordPress plugins available that will minify your CSS and JavaScript files, plugins like WP-Minify or W3 Total Cache.

7. Use a Content Delivery Network (CDN)

A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the internet that deliver webpages and other web content to a user based on the geographic locations of the user.

When a specific request is made by a user, the server closest to that user in terms of the minimum number of nodes between the server and the user is dynamically determined and used there is an immediate and dramatic reduction in the effort required by your server to deliver your site content to visitors.

CloudFlare is a very popular choice when it comes to CDN providers. CloudFlare offers both free and paid plans. Another very popular and well known CDN service is MaxCDN. There are many others free and commercial CDN providers do your own research find out which one best suits your needs. You must evaluate whether the CDN service actually speeds up your site’s performance. Most existing CDNs are built to address the delivery bottlenecks that existed years ago.

8. Install a Caching Plugin

If you have not done it already in the previous steps above, install a caching plugin for your WordPress site. There are a lot of things you can do to optimize your WordPress website, however installing a cache plugin will have most likely the biggest effective on your page loading times.

There are two main reasons why we use caching: to reduce latency (improve page load speed) and to reduce network traffic (amount of data loaded thus saving us a lot of bandwidth).

Each time someone visits your website, WordPress will go through a lengthy process to build everything on the page. First it will process the PHP code which will make numerous calls to your database for the content that’s supposed to be in the page and then it will dynamically build the page on the fly before it gets delivered to your visitor. Once that visitor is gone or goes to another page, the page disappears and the process starts over again.

The main “issue” with this process is that the server has to create the page every time someone looks at it. This is a lot of work for a server to perform and it can struggle when you have a lot of visitors visiting your site all at once.

A caching plugin keeps WordPress from having to create a new page every time. The page is created once and held onto (cached) for a set period of time. Visitors then would get cached version of the page, which prevents the server from having to go through a lengthy process of building everything on the page from scratch.

There are several WordPress cache plugins out there, below you’ll find the most popular and highly recommended ones:

W3 Total Cache is one of the most popularly known caching plugin for WordPress. It’s used by several leading WordPress-powered blogs.

WP Super Cache is also very popular WordPress caching plugin. It generates static HTML files and serve these static HTML files to your website visitors.

WP Fastest Cache another new popular WordPress caching plugin.

9. Optimize your database

From time to time it is a good idea to do a little housekeeping with your WordPress installation.  Over time, your MySQL database will build up overhead that slows down your websites and compromises performance.

Optimizing database tables can be done manually using web database management tool like phpMyAdmin or by using a plugin. However, if you’re not familiar with phpMyAdmin, then a plugin may be a safer option for you.

WP-Optimize is a database cleanup and optimization tool that allows you to remove post revisions, comments in the spam queue, un-approved comments, and much more with just few clicks.
WP Clean Up is another very popular database cleanup and optimization plugin.

10. Place CSS in Head and JavaScripts in Footer

If possible all Cascading Style Sheets (CSS) should be in the document’s <head> to make them load and render as soon as possible. Some browsers don’t render the page at all before all Cascading Style Sheets (CSS) have been loaded and parsed.

JavaScripts that are not crucial for the website’s rendering should be placed in the document’s footer. This ensures the browser does not begin executing them before the page has finished loading, affecting its performance.

Scripts To Footer this small plugin moves scripts to the footer to help speed up page load times, while keeping stylesheets in the header.

11. Reduce the Number of External Scripts

If possible try to avoid external scripts, directly or through plugins. A really common cause for slow WordPress sites, is the existence of too many external scripts. Having things like slow social media buttons and offsite videos are examples that can have a big impact on the load time.

12. Add Expire Headers for Static files

Another good way to reduce the number HTTP request is to add expire headers for static files. By doing this you tell the browser how long to store a file in the cache. This way you improve load times for returning visitors.

To set the expire header you need to edit your .htaccess file

# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"

Just as a final thought, some things are more important than speed it’s worth keeping in mind that speeding up your site involves compromise. If there are some plugins / features you can’t live without, it makes sense to keep them and take a bit of a hit speed wise.