optimize wordpress speed

How to optimize your WordPress website for Speed and Performance

The time your website takes to load greatly contributes to the success of your online business. If it’s slow, it will turn your visitors away. In fact, if it takes forever to load, they may not even think twice to hit the back button before letting your website load completely.

Though WordPress, as a CMS, is very well-coded, a majority of webmasters mess their WordPress sites by choosing a poor web host, installing plenty of low-quality plugins, and filling it with piles of garbage.
But even if you do not do such things with your website, there is still a possibility for improving your website’s performance and speed. There are various techniques that you can leverage to optimize your WordPress site for speed and performance while boosting your conversion rate.

Steps to Optimize WordPress Speed & Performance

1. Use a Caching Plugin

Wordpress Caching Plugin

WordPress is a server side programming language which is written in PHP. This means whenever your website is visited, it submits a request to the server to process it and then displays it on the screen.

This makes your website slow when multiple users try to access your site. However, WordPress enables you to break this monotonous process and display a cached version of your website to the user by reducing calls to your server and preventing it from downloading the same files on the user’s system again.

In order to generate a cached version of your website, you need to use a cache plugin such as W3 Total Cache or WP Super Cache. A caching plugin enables your website to load static content such as JavaScript files, CSS, and images from a reliable caching source. It’s much faster to load your website from the cache instead of the server.
Additional caching features include Content Delivery Network (CDN) support, Gzipping, caching of feeds, minification and much more.

2. Enable gZip Compression

Wordpress GZIP Compression

The third most effective way of optimizing your website for speed and performance is gZip Compression. GZIP compression decreases the size of the web files including HTML, CSS, JavaScript files and images that are being transferred between your users and the server. GZIP compression compresses your files up to 70-80%, which are then sent to your visitor’s browser. But before rendering the files, the browser automatically decompresses it and displays the extracted files.

Note: To check if Gzip Compression is already enabled on your website, you can use https://www.giftofspeed.com online tool.

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


  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/opentype
# For Olders Browsers Which Can't Handle Compression
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html



Enable GZIP in WordPress

Though this method is not always recommended as it involves PHP for enabling GZIP compression, it can be used by those who are new to WordPress and don’t know how to add code to the .htaccess file. But still, if it’s not the last option left, try not to use it.

Steps to enable GZIP in WordPress:

Navigate to http://yourwebsite.com/wp-admin/options.php
Look for gzipcompression setting
Once found, change the value of GZIP field from 0 to 1

2. Enable Browser Caching

browser caching

As a matter of fact, many files on your website do not change including images, JavaScript files, CSS files and more. The most effective way to take advantage of this is to enable browser caching, which enables your users to store a cached copy of your site locally to speed up its loading time.
To enable browser cache for your website, you need to add the following lines of code to your .htaccess file.

## EXPIRES CACHING ##

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"

## EXPIRES CACHING ##


The above code indicates how long a specific file must be stored locally. If the time expires, the files will be downloaded again automatically.

4. Optimize your images

optimize images

There is no denying the fact that visual content plays a crucial role in making your website more engaging and user-friendly. However, adding tons of images to your website makes your website a lot slower. So does this mean you should stop using them? Of course not! However, you need to ensure that the images you are using on your website are accurately optimized.

There are plenty of image editing tools that enable you to save optimized images without losing their quality. One such tool is WP Smush.it. It is a popular image optimization WordPress plugin that automatically smushes your images to get rid of all the additional information attached to it such as GPS coordinates, the camera used for the photo, creation date and more, thus decreasing their load time significantly.

5. Optimize your WordPress Database

optimize your wordpress database

If you have been using WordPress for quite some time, your database will probably be filled with tons of data that’re of no use. Thus, it’s important to optimize your database performance and speed.

Well, this can be done simply by using a WordPress plugin such as WP-DBManager, WP-Optimize or WP-Sweep plugin. It cleans up your WordPress database for orphaned meta, post revisions, trash, pending spam comments, auto-saved drafts and more.

Conclusion

Optimizing your WordPress website has become the need of the hour. Slow loading websites not only leave bad impressions on users but also influence your search engine rankings. Moreover, as reported by a survey, a web user tends to abandon a website that takes more than 3-5 seconds to load. I’m pretty sure, you wouldn’t want to be in the category of abandoned websites.

Before you optimize your website, check it’s current speed using Pingdom’s Site Speed Test to know how much your website has improved.