How to Optimize WordPress Website for Fast Loading Speed?

Many people searching and asking that how we can optimize our WordPress website for fast loading speed. In this tutorial, I will show you how you can speed up your WordPress site. Having a fast loading website is very essential to get high SERP and great user experience as well. If your website taking much time in loading then you need to take serious precautionary measures for that.

Why Site Speed Is Important?

You’ve probably heard this term before but may be you are not clear yet. When a person lands on your blog or website, you only have 8-10 seconds to get positive or negative expressions from your visitor. If you are doing online business, then you should know the value of a customer. After that, it’s up to you that can you convert this visitor to permanent visitor or not. Website loading will be the most important factor here, if your website has fast loading, then it will leave a positive expression and if not then you should worry about that.

So, here I will share you some killer tips through which you can optimize your WordPress website well and reduce loading time. If you implement all these tips on your website, your loading time will be like rocket.

Before going to try these tips, I will suggest you to check current website performance by using free services like Google PageSpeed Insights and pingdom. These tools will show you overall loading time of your website.

How to Optimize WordPress

1. Choose the Right Hosting Plan

Always choose right hosting plan for your website. Whenever you try to create a new website, then you should purchase hosting from well reputed hosting companies. If you server taking long time execute HTTP requests and MySQL commands then you are fighting a losing battle.

Lot of people purchasing hosting from well reputed companies but still they are facing problem because they choose the best hosting platform not best hosting plan. Majority of the people using shared hosting and they people facing much problem because hundred of domains are running on the same server.

Anyhow, no matter which hosting and which hosting plan you are using, it will always suffer from insufficient RAM and CPU usage. Therefore, you need to purchase such hosting plan that could run your website smoothly.

If you want to host WordPress site, then I will recommend you WP Engine.

2. Use Fast WordPress Theme

You might be surprised here, but the Twenty Ten/Twenty Eleven are quite speedy themes to use because they keep it the “guts” simple and not making any extra loading time.

Avoid themes that design and coded badly or theme consist of images throughout. Always choose responsive theme for WordPress that should optimized for desktops, tablets and mobile and other devices.

 

3. Update & Monitor Your WP Plugins

Majority of people confuse here, people always asking me how many plugins should I use? How many plugins will enough for my blog? So, I think before installing any plugin, you should ask yourself, “is this plugin is helpful and necessary for me”?

Too many plugins can create problems for you. Use just necessary plugins and keep them up to date. Here are few plugins that I think you should use for your website.

#1 WordPress SEO (For search engine optimization purpose)

#2 W3 Total Cache (For caching and better page speed)

#3 Wordfence (For security)

#4 Google XML Sitemaps (For creating XML sitemap of your website)

#5 WP Smush.it (For Images Optimization)

#6 WP-Optimize (For Database Optimization)

These are some essential WordPress plugins that you should use in any situation.

If you are already using too many plugins and you are in confusion which plugin should I keep and which one should I remove. So, one plugin that i highly recommend you use is P3 Profiler. It will show you will plugin creating problem for you, and just deactivate plugin that creating much headache for you.

 

4. Empty Your Trash

Recently WordPress introduced new feature. Whenever post, page, media or comment deleted, it will be store in trash automatically. From here, you can restore it and also can delete permanently. This garbage can create an extra burden of database. After thirty days, WordPress will delete trash file automatically, but you can change this duration by making few changes in wp-config.php file. You can reduce thirty days to 7 days by adding this code.

define (‘EMPTY_TRASH_DAYS’, 7);

You can completely disable the trash function by adding following code to your wp-config.php file.

define (‘EMPTY_TRASH_DAYS’, 0);

5. Optimize Your Images

Images are very important for any website and playing critical role in loading. Remember that don’t upload high resolution and extra large images. No need to be worried, has an images optimizer here that will optimize your images very effectively.

Yup, I am talking about WP-SmushIt, this is very useful plugin for optimizing images. It will reduce the size of images without disturbing quality of images. Just install this plugin and active, it will do rest of work automatically.

6. Use an Effective Caching Plugin

Cache plugins are very essential to publish static HTML files instead of your dynamic files. Cache plugins will greatly reduce the loading time of website and better user experience. Many effective cache plugins are out there, but W3 Total Cache, and WP Fastest Cache and WP Super Cache are highly recommended plugins to use. These plugins also include many interesting features as well like, minification, caching of feeds, Gzipping, Content Delivery Network (CDN) support, and much more.

7. Optimize your WordPress Database

It will be good if you are optimizing your database from time to time. You can simply use plugins for that.

#1 WP-Optimize

#2 WP-DB Manager

These two plugins can help you to keep your database optimized. I will recommend you to use WP-DB Manager because it can schedule dates for database optimization.

8. Minify and Combine CSS and Javascript

This is very important step in optimization. Combing these files will help you to reduce your WordPress loading time. As you know when ever visitor visits our website, his computer sends a request for these file and then our server send it back. So, when more requests will come, automatically loading time will increase because of server response.

Number of such plugins are available that can minify your CSS and Javascript. These two plugins are really helpful for this task.

#1 WP Minify

#2 Better WordPress Minify

9. Use a CDN (Content Delivery Network)

CDN (Content delivery networks) are server networks that clone your website on all of their location nodes. In simple words, when your visitors request your website, it will be served by the nearby server location, rather than the main datacenter of your hosting provider. CDN takes the heavy work and files away from your original hosting company by hosting your images, CSS files and Javascript , and serving these files to users from the nearest location to them.

There are many CDN are available, but here are some popular contents delivery networks that can help you in WordPress optimization.

#1 MaxCDN

#2 Amazon

#3 EdgeCast

#4 CloudFlare

10. Enable Browser Caching

Many browsers allow users to store cache locally for their favorite website for better loading time. This will reduce HTTP requests and will increase your speed.

You Can do this by adding below code to your .htaccess file:

## EXPIRES CACHING ##

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/jpg “access 1 year”

ExpiresByType image/jpeg “access 1 year”

ExpiresByType image/gif “access 1 year”

ExpiresByType image/png “access 1 year”

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 year”

ExpiresDefault “access 1 month”

</IfModule>

## EXPIRES CACHING ##

11. Leverage Browser Caching

Leveraging the browser caching means you have to specify how long user’s browser should cache your images, CSS file, JaveScript file, flash and other files. You can add below code in your .htaccess file to enable this function.

## LEVERAGE BROWSER CACHING ##

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/jpg “access 1 year”

ExpiresByType image/jpeg “access 1 year”

ExpiresByType image/gif “access 1 year”

ExpiresByType image/png “access 1 year”

ExpiresByType text/css “access 1 month”

ExpiresByType application/pdf “access 1 month”

ExpiresByType application/x-javascript “access 1 month”

ExpiresByType application/x-shockwave-flash “access 1 month”

ExpiresByType image/x-icon “access 1 year”

ExpiresDefault “access 2 days”

</IfModule>## LEVERAGE BROWSER CACHING ##

12. Set an Expire Header for the Static Content

An Expires header is an approach to determine a period far enough later on so that the customers programs don’t need to re-get any static substance, (for example, CSS record, javascript, pictures and so forth).

Along these lines can cut your heap time essentially for your standard clients.

Add below code to your .htaccess file to enable this function.

<IfModule mod_expires.c>ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.

ExpiresDefault      “access plus 1 month”

# cache.appcache needs re-requests

# in FF 3.6 (thx Remy ~Introducing HTML5)

ExpiresByType text/cache-manifest “access plus 0 seconds”

# Your document html

ExpiresByType text/html “access plus 0 seconds”

# Data

ExpiresByType text/xml “access plus 0 seconds”

ExpiresByType application/xml “access plus 0 seconds”

ExpiresByType application/json “access plus 0 seconds”

# RSS feed

ExpiresByType application/rss+xml “access plus 1 hour”

# Favicon (cannot be renamed)

ExpiresByType image/x-icon “access plus 1 week”

# Media: images, video, audio

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 video/ogg “access plus 1 month”

ExpiresByType audio/ogg “access plus 1 month”

ExpiresByType video/mp4 “access plus 1 month”

ExpiresByType video/webm “access plus 1 month”

# HTC files  (css3pie)

ExpiresByType text/x-component “access plus 1 month”

# Webfonts

ExpiresByType font/truetype “access plus 1 month”

ExpiresByType font/opentype “access plus 1 month”

ExpiresByType application/x-font-woff   “access plus 1 month”

ExpiresByType image/svg+xml “access plus 1 month”

ExpiresByType application/vnd.ms-fontobject “access plus 1 month”

# CSS and JavaScript

ExpiresByType text/css “access plus 1 year”

ExpiresByType application/javascript “access plus 1 year”

ExpiresByType text/javascript “access plus 1 year”

<IfModule mod_headers.c>

Header append Cache-Control “public”

</IfModule>

</IfModule>

 

13. Disable Hotlinking and Leeching of your Content

In other words, it means bandwidth stealing. It happens when other websites direct link to the images on your website from their posts making your server load ever higher.

Place this code in your root .htaccess file in order to enable this function:

#disable hotlinking of images with forbidden or custom image option

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?sparringmind.com [NC]

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/latesttutorialcom [NC]

RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

Note: Please changes feed burner name with your link, otherwise images will not work there.

14. Compress Your Static Content with gZip

This is also imperative step in optimizing WordPress. Compressing the static contents with gZip compression will radically change your website loading time.

Please add below code in your .htaccess file:

<IfModule mod_deflate.c>

# force deflate for mangled headers

# developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/

<IfModule mod_setenvif.c>

<IfModule mod_headers.c>

SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding

RequestHeader append Accept-Encoding “gzip,deflate” env=HAVE_Accept-Encoding

</IfModule>

</IfModule>

# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:

<IfModule filter_module>

FilterDeclare COMPRESS

FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html

FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css

FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain

FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml

FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component

FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript

FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json

FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml

FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml

FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml

FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml

FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject

FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml

FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf

FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype

FilterChain COMPRESS

FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no

</IfModule>

<IfModule !mod_filter.c>

# Legacy versions of Apache

AddOutputFilterByType DEFLATE text/html text/plain text/css application/json

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE text/xml application/xml text/x-component

AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml

AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype

</IfModule>

</IfModule>

15. Choose Your Advertisements Wisely

This is crucial stage in optimization that mostly people ignore it. Heavy flashed or heavy color scheme advertisement can add extra time in loading. Don’t make your website pond of advertisement. Use limited ads network on your website.

16. Add LazyLoad to Your Images

This plugin works very effective in WordPress optimization. It is the procedure of having only the images above the fold load, in simple words images will be visible to the user when he scroll down website page, as user will crawl down, images will start loading. This will help you to save bandwidth as well.

To enable this function, install jQuery Image Lazy Load plugin.

Conclusion:

So here I describe briefly how to optimize WordPress website for fast loading speed. I doing all these steps, now check your loading time or check with performance by using any free tool. I can assure you, your website loading time will be better. If you have any problem or any question regarding this article, please make comment.

You May Also Like

About the Author: WAQAS AHMED

Waqas Ahmed is founder of this blog, I am a professional blogger, web designer, developer & SEO expert. Find me on Facebook | Twitter | Google +

6 Comments

Leave a Reply

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