How to Make the WordPress Blog Faster

0
Make WordPress Blog Faster

Hello guys, today I am going to share an idea to make your WordPress blog faster. Blog loading speed is an important factor to get more visitors and get good rank in the Google. Most of the time user comes to your blog and left it due to load time. This ultimately increases bounce rate on your blog.

Things you should keep in mind: 

Let’s start making your WordPress blog faster

Before you make any changes, I advise you to check your blog speed using online services listed below:

Once you done with the pre-test, start modifying for more speed. So that you can identify which configuration gives the best performance on your server.

1. Enabling Gzip compression

This will compress the HTML and CSS and will improve the page loading speed and reduces the bandwidth usage.
The setup is different from one server to another so you may have to look on your host instructions section to see how you can enable it on your site.

## BEGIN Enable GZIP Compression ##
<IfModule mod_deflate.c>
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
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml
SetOutputFilter DEFLATE
</IfModule>
## END Enable GZIP Compression ##

2. Set the Leverage Browser Caching

By setting this you’ll tell your visitors browsers to remember (caching) some of your website resources that you don’t change so often (like the logo or the css/js libraries, posted images, etc.) and only refresh them after a defined period of time.
To set it you have to add something like this on your.htaccess file. Add the following code to the .htaccess file.
NOTE: The setup may differ based on what resources you want to include.

## BEGIN Leverage Browser Caching ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## END Leverage Browser Caching ##

3. Set Vary: Accept-Encoding Header

## BEGIN Vary: Accept-Encoding Header ##
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
## END Vary: Accept-Encoding Header ##

4. Optimize images

If your blog has more images, it will reduce your server response time as the user have to download all the images each time they access your pages. To reduce images size, you need to compress and optimize your images. It will aid to increase blog loading speed.

To Compress and optimize images there are various plugins available in WordPress plugin repository. Some of the good plugins are listed below:

  • WP Smush.it
  • EWWW Image Optimizer

After that put the following code at the bottom of your theme’s functions.php file.

add_filter( 'jpeg_quality', create_function('', 'return 50;' ) );

This will automatically compress each thumbnail to 50%. You can change value 50 as per your need. For me, 50% gives the best performance. You can use Thumbnails regenerator plugin to regenerate all thumbnails after adding above code in functions.php file located in theme’s directory.

5. Lazy Load Images

There are many lazy load plugins available among them Lazy Load is my favourite one. It uses jQuery.sonar to only load an image when it’s visible in the viewport.

6. Remove Query Strings from Static Resources

It is a good idea to remove query strings from the static resources as it cause caching issues with some proxy cache and CDN. To remove query strings, add following code at the bottom of the functions.php file located in theme’s directory.

## BEGIN Remove Query Strings ##
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
## END Remove Query Strings ##

7. Use a cache plugin

Cache plugin generates static files of your content and serves them to the user whenever user access your pages/posts. This dramatically reduces server response time. I personally use WP-Super Cache plugin on my all websites.

Conclusion

So, is this all about making your WordPress blog faster. You have to make some changes in .htaccess and functions.php file to get good performance. Reduce HTTP requests to speed up your WordPress blog. You can use plugins to improve speed but I would advise you to use less number of plugins on your WordPress blog.

LEAVE A REPLY

Please enter your comment!
Please enter your name here