Speed Up WordPress: 21 Ways To Boost The Speed of Your WordPress Website

by Mohit Gangrade • Last Updated: 7 June 2017
Speed Up WordPress

Let’s face it:

No one likes to wait for a website to load.

And it doesn’t matter how good your content is…

… If your website takes more than 3 seconds to load, most people will leave right away.

So, if you want more people to stay on your site, you will have to work on its speed.

Why Your WordPress Site’s Speed Matters

Here’s the most important reason why:

If your site is slow, most people will leave and never come back again.

In fact, according to Kissmetrics, 47% of the consumers expect a web page to load in 2 seconds or less and 40% will abandon a website that takes over 3 seconds to load.

That means, if your website takes more than 3 seconds to load, you are losing a lot of subscribers and revenue.

Not only that, according to WebsiteOptimization.com, if your website is slow:

  • it will be perceived as low-quality
  • will raise your users’ blood pressure
  • and decrease your traffic by up to 20%

I could literally go on for hours and give you a thousand more reasons…

… but I am sure you get the theme.

The faster your website, the better.

How To Speed Up WordPress

1. Switch To A Faster Theme

Impact On Speed: Medium

Switch To A Faster WordPress Theme

Look:

The theme you use has a major impact on your website’s speed.

So, it’s important to invest in a good theme right from the start of your blog.

But here’s the problem with most themes:

They are not optimized for speed.

In fact, most beautiful-looking themes are poorly coded and don’t follow the WordPress coding standards.

These themes not only make your website slow but also leave it vulnerable to hackers.

The bottom line?

Invest in a high-quality, light-weight theme that is optimized for speed.

This sounds easy…

… but there are hundreds of thousands of WordPress themes available to choose from which makes it really difficult to find a good theme.

What’s the solution?

Use the default WordPress themes that come preinstalled…

…Or buy themes from a trusted theme provider like Elegant Themes or StudioPress.

These guys build themes that are optimized for speed and security.

2. Move To A Better Web Hosting Service

Impact On Speed: Medium

Move To A Better Web Hosting Service

Here’s the problem with cheap shared web hosting services:

They make your website slow.

Why?

On a shared hosting service, you share the same server resources with hundreds of other websites.

This means if one of the websites start getting massive amounts of traffic, your site will end up suffering.

Not only that, if the server crashes, your site can go offline for hours.

Sounds scary, right?

But this doesn’t mean you should totally avoid shared hosting services.

They are a good starting point.

But as your website’s traffic grows, you should consider moving to a managed service.

A managed WordPress hosting service offers faster performance and better support.

These guys know what they are doing.

Their servers are optimized for speed and can handle large spikes in traffic very easily.

The bottom line?

If you want your website to be fast, invest in a better web hosting service.

Start with a Shared Hosting service if you are low on budget, but as your traffic grows move to a managed hosting provider.

3. Enable Browser Caching

Impact On Speed: Medium

Enable Browser Caching

Look:

There are a lot of static files that are loaded across all the pages of your website.

These include your Logo, CSS files, JavaScript files and other site-wide resources.

These resources are loaded every time a visitor visits a different page of your website.

This means, browsers will download your logo every time the user visits a different page.

Loading the same resources over and over again is redundant.

It just increases the loading time for your pages.

The solution?

Leverage browser caching.

It’s a simple technique of caching commonly-used resources on the browser-side.

Here’s how it works:

When a user visits your website, her browser downloads all the resources used on the page and makes a copy.

If you don’t have browser caching enabled, browsers download a new copy every time your users visit a different page.

And when you have browser caching enabled…

… browsers cache (make a copy of) your files and display these cached resources every time your users visit a page.

This reduces the number of resources the browser has to download.

To enable browser caching, you will have to add the following code to your .htaccess file:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg “access 1 month”
ExpiresByType image/jpeg “access 1 month”
ExpiresByType image/gif “access 1 month”
ExpiresByType image/png “access 1 month”
ExpiresByType text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 month”
ExpiresDefault “access 1 month”
</IfModule>

The above code will request browsers to cache your resource files like images and CSS for one month.

4. Give Your Site A Boost With Caching Plugins

Impact On Speed:  Very High

Give Your Site A Boost With Caching Plugins

When someone visits your website…

WordPress goes through hundreds of tasks to generate the requested page.

And this happens for every single visitor.

Not only does this takes a lot of time, it also increases the load on your server.

This is where caching plugins come to rescue.

They make the process of serving a page faster.

How?

By removing the need to generate pages every time they are requested.

Let me explain.

A caching plugin caches (makes a copy) of every page the first time the page is requested.

And when the “cached” page is requested again, a stored pre-generated copy of that page is served.

This cuts the time required to generate a page by half.

The bottom line?

Start using a caching plugin like WP Super Cache.

It’s free, easy to set-up and comes with a lot of features.

5. Optimize Your Images

Impact On Speed: Medium

Here’s the deal:

Images make up more than half the weight of your website.

And if you can reduce their size, you will be able to reduce the size of your website.

The best way to reduce the size of your images is to optimize and compress them without compromising the quality.

Now, to do this, you can use a tool like CompressPNG.

But compressing images one at a time can take a lot of time.

This is where WP-SmushIt comes to rescue.

It compresses and optimizes all the images on your WordPress site automatically.

6. Optimize Your WordPress Database

Impact On Speed: Medium

WordPress stores a lot of data in the database to help it perform important tasks.

And over time, a lot of this data becomes redundant.

This redundant data in your database keeps on growing over time.

And as you might know, the larger your database, the slower your site.

So, it’s a good idea to optimize your WordPress database every month.

To do this, you can use a plugin like WP-Optimize.

It’s a free plugin that deletes all the redundant data from your blog’s database.

7. Make Your Pages Load Faster by Lazy-Loading Your Images

Impact On Speed: High

Look:

Browsers try to load up all the images on the page at once.

They load one image…

… and then move to the next.

This keeps on going until there are no images left on the page.

And as you might have guessed, this takes a shit ton of time.

That means, the more images you have on your page, the slower it will load.

And it’s probably not a good idea to reduce the number of images on your page as it can compromise the quality.

So, what’s the solution?

Lazy-Loading your images.

It is a simple technique of loading images only when they are visible to the user.

This means an image located at the bottom of the page won’t be loaded until the user reaches the bottom.

This limits the number of images the browser has to load and makes your site load faster.

A good example of this in action is Neil Patel’s blog:

Images on Neil Patel's Website

Do you see that gray rectangle at the bottom?

It’s an image being lazy-loaded.

As you might know, Neil Patel’s blog posts are filled with tons of images.

Sometimes, literally as much as a hundred of them.

But his site still loads up under two seconds.

That’s the magic of lazy-loading.

Now:

To implement this technique, you don’t need to hire a developer.

Just install the free BJ Lazy Load plugin and you are good to go.

8. Limit The Number of Post Revisions

Impact On Speed: Low

Limit The Number of post Revisions

Post Revisions is an awesome feature offered by WordPress.

It helps you go back to the previous versions of your posts.

Made a mistake while editing your posts?

Go back to an older version of your post with just a click.

Every time you make changes to a post, WordPress stores the old copy of the post as a revision.

It’s a really helpful feature.

But here’s the problem with Post Revisions:

WordPress can create and store hundreds of revisions for every post on your blog.

And most of these post revisions are useless.

The more post revisions in your database, the slower your website.

To solve this problem, you can limit the number of revisions WordPress creates for every post.

To do this, you will have to add the following code to your wp-config.php file:

define(‘WP_POST_REVISIONS’, 5);

define(‘AUTOSAVE_INTERVAL’, 300);

It will change the default autosave interval from 60 to 300 seconds and will limit the amount of revisions per post to 5.

9. Deactivate Unused Plugins

Impact On Speed: High

Most people don’t realize this:

The number of plugins you use on your blog impacts the speed of your website.

That means the more plugins you use on your website, the slower it will get.

This is because each plugin you install on your website increases the number of tasks WordPress has to perform on every request.

For example, if you install an Anti Comment Spam Plugin on your blog, it will run every time someone posts a new comment.

Deactivating unused plugins is probably one of the easiest ways to increase your blog’s speed.

Just visit your plugins page in your WordPress dashboard and deactivate every plugin that isn’t in use.

10. Split Comments Into Pages

Impact On Speed: Medium

Here’s the deal:

If you are getting a lot of comments on your blog, it’s a good thing.

It means you have an engaged audience.

Congratulations

But here’s the problem with too many comments:

They increase the size of your web page and make your site slow.

Not only that, the more comments there are to load on a page, the more time it will take WordPress to generate the page.

To solve this problem, you can split your comments into pages.

This will reduce the size of your blog posts and will make your site load faster.

Here’s how you can do this:

Login to your WordPress dashboard and navigate to Settings -> Discussion.

Now, check the “break comments into pages with” checkbox:

11. Minify JS and CSS files

Impact On Speed: Medium

The size of your files has a major impact on page load time.

Now, there’s not much you can do to reduce the size of your files…

…. But when it comes to CSS and JavaScript files, you can easily minify them.

What does it mean to minify?

In simple words, it means to reduce the size of these files by removing redundant characters.

These redundant characters include blank spaces, tabs, newlines and comments.

To do this, you can use the free Autoptimize plugin.

It’s a free plugin that optimizes your CSS and JavaScript files to improve performance.

It does more than just minifying these files.

It also concatenates, caches and adds expires header to them.

12. Enable GZIP Compression

Impact On Speed: Very High

GZIP Compression is a method of reducing file size.

It can reduce the size of your files by more than half.

It will not only save you tons of bandwidth but will also boost the speed of your website.

When GZIP compression is enabled on your server, all files are compressed on the fly before they are sent to the browser.

This reduces the size of all your files (HTML, CSS, JavaScript and Images) by more than half.

To enable GZIP compression, add the following code to your .htaccess file:

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

Alternatively, you can use the free GZip Ninja plugin.

13. Disable Hotlinking of Your Content

Impact On Speed: Medium

Disable Hotlinking of Your Content

I get it. People love your content and like to share it on their own websites.

Because let’s face it:

You are awesome.

And I also know how good it feels when people share your content.

But here’s the problem with that:

When people share your content on their own site…

… they tend to use your servers to serve images and videos.

This increases the load on your servers and bandwidth usage.

That means, poor performance for your readers and increase in hosting costs.

To get around this problem, you need to stop people from “hotlinking” your content.

And here’s how you can do it:

Paste the following code at the end of your blog’s .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?your-website.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [F]

Before you use the above code, you will have to change your-website.com with your real domain name.

14. Load Scripts In Footer

Impact On Speed: High

Here’s the deal:

The position of the scripts on your page impacts your loading time.

This means If your scripts are at the top of your HTML…

… the browser will first load the scripts and then start rendering the page.

And the more scripts you have at the top, the more time it will take a browser to start rendering your pages.

The simple solution to this problem is to move your scripts to the bottom of the page.

Loading your scripts right before the closing </body> tag will allow the browser to start rendering your pages without the need to first load the script.

15. Use Async Scripts

Impact On Speed: Medium

When a browser loads a page, it will not render the content until it has loaded all the script files before the content.

A quick and easy way to solve this problem is to use an async script.

What is an async script?

It’s simply a script with the async attribute added to it.

This attribute tells the browser that it doesn’t have to wait to load the script to start rendering the page.

Here’s what an async script looks like:

<script src=’http://yoursite.com/script.js’ async=true></script>

16. Enable Keep-Alive

Impact On Speed: Medium

Here’s the deal:

When a browser loads your page, it has to create a new HTTP connection to your server for every file on the page.

This means, the more files you have on your page, the more the connections.

And here’s the problem with that:

It takes some time to create a connection to the server.

This time keeps adding up with every file.

To solve this problem, you can enable Keep-Alive on your server.

With Keep-Alive enabled, browsers can use the same HTTP connection to download more than one file.

To enable Keep-Alive on your server, add the following code to the top of your htaccess file:

<ifModule mod_headers.c>

Header set Connection keep-alive

</ifModule>

17. Use A CDN

Impact On Speed: High

Start Using a CDN

 

The time required to connect to a server depends on how far it is from the user.

In simple words, if you try connecting to a server far far away from your current location, it will take a little bit of time.

A Content Delivery Network (CDN) helps you solve this problem.

It simply replicates your website across a massive network of servers spread around the world.

And when a visitor requests your website, he is served from a server nearest to his location.

This cuts the time required to connect to the server by half.

It’s not the only problem a CDN solves.

It also improves the security of your website and decreases the load on your server.

If you are just starting out, try the free CloudFlare CDN service.

18. Turn Pages Into HTML

Impact On Speed: High

Look:

There are pages that don’t require any kind of processing on the server.

And to speed up these pages, you can turn them into HTML.

You should try turning pages that don’t change very often like static Landing Pages into HTML.

Because when you do this, you will see a huge boost in speed.

Why?

Because there will be no PHP code to execute, no data to pull from the database and no WordPress plugins to load.

When you do this, your server will be able to send the HTML file directly to the browser.

This will cut the time required to serve the file by more than half.

19. Reduce Number of Requests

Impact On Speed: Medium

Here’s the deal:

The number of files there are to load on a page impacts the speed of your website.

Because for every file, the browser has to connect to the server and download it.

That means, if you have multiple files to load on your page, the browser will have to create a new connection to download every file.

And obviously, this is not efficient at all.

Combining multiple files into one is a good way to minimize the number of  HTTP requests.

You can combine multiple CSS files and JavaScript files together to reduce the number of files there are to load.

20. Reduce Number of Images Per Page With Image Sprites

Impact On Speed: Medium

Look:

The more images there are to download, the more time it will take the browser to load the page.

And the best way to reduce the number of images on your pages is to use an Image Sprite sheet.

An image sprite sheet is simply a collection of images put together into a single image.

Here’s what a sprite sheet looks like:

Mailchimp Spritesheet

The above image is a sprite sheet used by Mailchimp.

Sprite sheets can massively reduce the number of images the browser has to download.

If you want to learn more about CSS Sprites, Check out this awesome tutorial by CSS Tricks.

21. Disable Pingbacks and Trackbacks To Reduce Server Load

Impact On Speed: Medium

Pingbacks and Trackbacks are WordPress’s way of communication with other blogs.

I know it sounds like a helpful feature.

But here’s the problem:

It can put a lot of load on your servers.

Why?

Because when enabled, Your WordPress site sends a notification to every blog you link to…

… And receives a notification from every blog that links to you.

And as you might have guessed, this increases the load on your servers and can make your site slow.

The solution?

Simply disable Pingbacks and Trackbacks by navigating to Settings -> Discussion:

Conclusion

If you want to speed up your WordPress site, go through each of these tactics one by one. Most of them don’t take much time and some only require you to install a plugin.

If you got stuck somewhere or want to share your thoughts, feel free to leave a comment below.

Comments

No Comments Yet. Be The First To Comment!

Leave a Comment

Your email address will not be published. Required fields are marked *