20 Ways To Speed Up and Optimize a WordPress Website

You write great content but what if your website takes decade to load?

Well, Visitors don’t have patience and It has been proved. More than quarter of visitors will abandon your website if it takes more than 3 seconds to load. Your potential visitors even might hit back button in browser before they read your content. Hitting back button is a direct message to search engine that user did not get what he was expecting on a page and next time your content might rank lower.

There are so many good reasons why you should put efforts in improving the speed of your website. Here are some worth mentioning –

  • PageSpeed is a ranking factor – Google has already said that page speed will be one of the ranking factor for their search index and search engine gives more value to pages which load fast.
  • User Experience – Slow loading website gives a bad user experience. User can navigate easily to different pages on a fast website which results in increased total page views and decreased bounce rate.
  • Conversion rate – Don’t you want to see your visitors converting in your customers? Fast web page improves conversion rate. Amazon once announced that conversions dropped by 7% every time their website was loading late by 1 second.
  • SEO – Fast websites are definitely rewarded by search engines. Speeding up a website can be first step towards Search engine optimization.
  • Hosting Resources – If your website is optimized, then it won’t be needing a lot of hosting resources to run smoothly. If you are on shared hosting and websites is not optimized and consuming and exceeding resources limit then your website might go down.

Hope you have understand the importance of pagespeed by now. So, are there any tools for measuring pagespeed or loading time of a website? Yes there are. Google PageSpeed, Pingdom and GTmetrix are recommended tools for analysing a website’s performance. You can get exact idea what is causing performance issues on your WordPress website.

Some of the most common problems behind a slow website might be Heavy unoptimized Images, Dense Coding, Too many advertisements, Unreliable Host, Embedded Media, Unoptimized plugins, lot of java scripts etc.

The speed of WordPress Websites can be greatly increased by doing simple things here and there. I have learnt a lot of lessons in past few years.

Here are 15 Tips to optimize and speed up your WordPress Website

1. Choose a Reliable Web Host

This is the first and foremost step in optimizing any website. If you go with a cheap host and it is not processing HTTP requests fast then no matter what you do at your end, your website can not be optimized beyond a certain limit. Your server must respond fast to the HTTP requests and SQL commands. Look at the image below. This happens when you choose a bad host –

high server responsive time

Although hosting alone can’t make your website fast, you have to work on various aspects on frontend but it does matters a lot. If you choose shared hosting then remember there might be hundreds of other websites on the same server and you have very limited resources to keep site running. Whereas with VPS and Managed WordPress hosting, you get better performance. So before choosing any hosting plan, consider how many visitors you have and how much hosting resources do you need to handle traffic smoothly.

2. Choose WordPress Hosting Plan

WordPress hosting is exclusively optimized for WordPress websites. You can skip a lot of optimization steps mentioned in this post just by going with WordPress hosting. For an example you don’t need to install caching plugin on Godaddy WordPress Hosting because their servers provides inbuilt caching. WordPress hosting can be of different types such as Shared, VPS and Managed WordPress Hosting.

3. Select Data Center Location Carefully

Be careful while choosing Data Center for your website. You get an option to choose data center location while buying hosting. If your website targets visitors in a certain reason of the world, choose a data center location nearby. Say your website is only for Indians, so you should choose data center in India or Asia so that your target users can access your website faster. Although visitors from a far region will experience slow loading of website but you can address this issue using CDN.

4. Opt for a Fast and Responsive WordPress Theme

First your theme should be responsive means it should be perfectly optimized for all browsers, screen sizes and devices. Second it must be well coded, lightweight, clean, secure, search engine optimized and robust.

On this blog I am using Genesis framework and quite happy with its speed. A standalone theme can be faster than a theme with framework. Everything comes with some cons and pros. WordPress default themes like twenty thirteen are also well coded and fast.

Unnecessary images, Javascripts, coding and other functionality whatever comes with theme will only increase the loading time of your website. Try to get no more than what you want.

5. Use a CDN

Actually you get an option to choose data center location for your website while purchasing Hosting. Say if your website is hosted in a data center in Europe then your website will take little more time to load when accessed from Australia or America while European visitors will see it loading faster. It is simple. Site will load faster for users who are lives near data center your website is hosted on. CDN(Content Delivery Network) is a great way to address this challenge.

Your website’s files such as scripts, images, css are hosted on various data centers(Provided by CDN) around the world. Now no matter where the user access your website from, the content is delivered from the nearest data center. This way CDN greatly reduce the loading time of website.

CDN not only reduces the number of requests but also saves bandwidth by a great extent.

2 popular CDNs are Cloudflare and MaxCDN.

6. Use a Caching Plugin

Using a caching plugin is a crucial for speeding up any WordPress website. Installing a caching plugin is perhaps the quickest way to cut loading time down significantly. Let’s see what a caching plugin do.

Whenever someone visits your website, some information are requested from your web host such as HTML, images, fonts, Scripts, PHP files, Posts, pages etc. And to make sure visitors are viewing up to date information, WordPress generates content dynamically means requests for fresh informations are being made every time visitor visits that page.

But as you know we don’t update posts and pages very frequently so why should we make a returning visitor wait every time even when he is requesting the same post/pages. This is where a caching plugin comes into play. It creates static HTML version of web pages and delivers cached version of the page to the returning visitor and thus greatly reduces the number of http, php and mysql requests made. And this is how our website loads fast.

When it comes to caching plugins, WP Super Cache and W3 Total Cache are 2 popular names. Good thing is that both are free. Caching plugins comes with some great additional features like minifying Javascripts and css.

7. Leverage Browser Caching

When a visitor visit your website, browser downloads all the content from server such as CSS, JS, post etc. When visitor visits another page, browser again downloads them all. But if Leverage Browser caching is on, the static files such as Java Scripts and CSS files will be stored in browser cache. So whenever visitor returns or opens different pages, only new content is downloaded from the server while static files such as javascripts and css are served from browser. This way leverage browser caching reduces pressure on your server by reducing the no. of requests and reduces the page load time by delivering files fast from browser instead of server.

How to enable leverage browser caching in WordP? By adding Expires Headers . Expires Headers tell browser if a certain file has to be downloaded from server or to be delivered from browser cache. Add the below code to .htaccess file of your website –

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault “access plus 1 month”
ExpiresByType image/x-icon “access plus 1 year”
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”
ExpiresByType text/css “access plus 1 month”
ExpiresByType application/javascript “access plus 1 year”

8. Enable Gzip Compression

Enabling Gzip compression reduces the size of files sent from your server to browser. It can reduce the size of the page by more than 50% and hence saves a lot of bandwidth. So how do you know if Gzip is enabled or disabled on your website? You can use online tools such as GTMetrix.

To enable Gzip compression you can login to hosting control panel and you will find an option there. You can also implement Gzip compression using .htaccess file. Just put the below code at beginning of .htaccess file and hit save –

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml

Caching plugin such as W3 Total cache also support enabling Gzip compression.

9. Minify JavaScript and CSS

It is advised to take a backup of these files before you do anything. As its name suggests, minifying is the process of reducing the size of JS and CSS files by removing unnecessary comments and white spaces from the files. Smaller files load fast.

minifying javascripts reduces page size

You can minify JS and CSS files using plugins. You don’t need to install a seperate plugin for it. If you have caching plugin installed, you can get this done.

One can also compress Javascripts and CSS manually using JS and CSS compression tools available online.

10. Combine JavaScript, HTML and CSS

One file, One request. More the javascripts and stylesheets there are, more will be the no. of requests for server to process and ultimately more will be the loading time of a website.

You can squish all the javascript files into one large file. Same can be done with CSS files. Doing this will reduce the no. of requests to server and website will load fast.

11. Eliminate Render-Blocking JavaScript and CSS

Above-the-fold is the area of website which a user sees at first sight as soon as he lands on. I mean the portion of website which is visible to user without scrolling down. So this portion should be rendered fast but javascript and css in between may take time to load and might increase loading time. I am not asking you to remove javascript and css files. Obviously you can not remove javascripts because you need them but one thing you can do is to move the render blocking javascript to the bottom.
Keep CSS at the top and move Javascript to the bottom of the HTML page. This is how to move javascripts at the bottom. Copy and paste below code to functions.php file on your WordPress website –

function remove_head_scripts() {
remove_action(‘wp_head’, ‘wp_print_scripts’);
remove_action(‘wp_head’, ‘wp_print_head_scripts’, 9);
remove_action(‘wp_head’, ‘wp_enqueue_scripts’, 1);

add_action(‘wp_footer’, ‘wp_print_scripts’, 5);
add_action(‘wp_footer’, ‘wp_enqueue_scripts’, 5);
add_action(‘wp_footer’, ‘wp_print_head_scripts’, 5);
add_action( ‘wp_enqueue_scripts’, ‘remove_head_scripts’ );

Note – Moving javascript at bottom might break design of website. Keep a backup for emergency before messing up things.

12. Optimize Images

Images take a lot of storage as well as time to load. But did you ever know the size of images can be reduced without compromising the visual quality. Yes WP-Smushit is the plugin which reduces the size of images significantly using lossless compression technique. You need not to worry about already uploaded images. The plugin can handle already uploaded images as well as new images during uploading process.

Another plugin is Lazy Load which makes sure that image will only be loaded when the area becomes visible to user.

One other thing you can do is enabling Jetpack Photon Module. Since It delivers images using globally distributed CDN, images load faster.

Small theme images such as logos at footer can be combined into one image using CSS sprite to reduce the no. of requests for the web server to process.

Specifying Image Size will a plus for your website speed. Actually browser figure out how to arrange content around image. So if you don’t specify the size of images, browser can take longer to figure this thing out.

13. Don’t Use a Lot of Ads

Advertisement comes with javascripts and images. You need to know that JS and Images, ads are using are hosted on other’s server which you don’t have any control over. You can not add expires headers to make them fast. You can not optimize their images. You can not reduce no. of request the ads make. I just want to say a lot of advertisement might affect performance of website as well as user experience.

14. Install AMP Plugin

AMP(Accelerated Mobile Page) is a project started by Google to make web fast. It’s going to be next big thing for webmasters. You can install AMP plugin available in WordPress Plugin repository. AMP plugin greatly reduced the loading time of a website on mobile. To accomplish this, it does these 2 things –

  • Most Javascript is forbidden
  • Uses its own server to deliver content

15. Enable HTTP Keep Alive

Enabling HTTP Keep-Alive allows the same TCP connection to send and receive multiple HTTP requests. It reduces the the delay before a transfer of data begins for subsequent requests. To enable Keep alive, paste the below code at the end of your .htaccess file

<ifModule mod_headers.c>
Header set Connection keep-alive

16. Repair and Optimize Database

This is one thing I do regularly and usually at the end of optimization process. Database gets messy over time. Empty spaces are left on database files after queries are executed. These spaces adds up and might affect MySQL performance. Optimizing database removes these empty spaces from files.

You can use Wp-Optimize, WP-dbmanager or any other plugin to repair and optimize MySQL database.

17. Install Well coded Plugins and Remove Unused Plugins/Themes

Only install a well coded, regularly updated and well optimized plugin because poorly developed plugins might cause performance issues. Also don’t forget to remove plugins which you are not using.

You can find troublesome plugin using P3(Plugin Performance Profiler) plugin. It will give an idea which plugin is consuming more hosting resources. You can later replace those plugins with better one. Don’t keep P3 plugin installed once you have find the culprit.

18. Remove Broken Links and Disable Hotlinking

Google does not like Broken links. Broken links lead your visitors to nowhere and increase bounce rate which is not a good thing. You can find all the broken links using broken link checker online and remove them manually. Actually broken links consume bandwidth and does not serve any purpose so they need to be fixed.

If someone is linking to images or other files on your website, it is called hotlinking. Hotlinking is considered bad because someone else is stealing your bandwidth and resources of your server. So you should disable hotlinking. To disable hotlinking ad this code to .htaccess file on your website –

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

Don’t forget to replace “yourwebsite.com” with the name of your website.

19. Turn off Pingbacks/TrackBacks and Delete Old Post Revisions

Everytime you hit save draft button while writing a post, WordPress saves version/revision of the post. It enables us to view and restore any old version of the post later.

post revisions in wordpress

You can delete old post revisions or control the number of post revisions WordPress should keep for your posts. This would reduce burden on database. Add this code to wp-config.php file –

define( ‘WP_POST_REVISIONS’, 3 );

3 is the number of post revisions.

Pingbacks and trackbacks serve no good purpose. You can turn them off by going to Setting>>Discussion .

20. Empty Trash and Block Spam Comments

Installing an antispam plugin is vital, otherwise your website will be flooded by spam comments. Akismet and Antispam Bee are two popular plugins to block spams comments and spam form submissions.
Whenever a post, page, comment and feedback is deleted, it goes to trash. You should regularly empty your trash. It will be your kind act to database of your website. If you can’t do it manually add this code to wp-config.php

define (‘EMPTY_TRASH_DAYS’, 7);

7 is the number of days after wordpress will delete your trash.

So these were some tips you can follow to speed up and optimize your wordpress website. Hope you will find this post helpful. If so share it among your friends.


Leave a Comment

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

Scroll to Top
Share via
Copy link
Powered by Social Snap