Speed Up: A Guide To Decreasing Your WordPress Load Time

Speed is a crucial aspect for any website. From affecting your views to your total revenue, it plays a significant role in website development and maintenance. Google already announced that they consider website speed when determining website rank. It only goes to show that speed has even become a defining factor for SEO purposes.

And this does not come as a surprise considering the fast-paced life of Information age. Why wait for a site to load when you can get the same information or avail the service at a different site that’s faster.

There are many tried and tested measures that one may resort to. Some will boost up the speed considerably, whereas some will get you those extra few seconds that can make all the difference. When dealing with a large website with a massive database and tons of plugins, you want to make the most of performance-optimization.

Now the question is: what can you do to make your WordPress website faster and more efficient? Here are a few simple steps that you can take that can make the crucial difference for you:

Speed Up A Guide to Decreasing your WordPress load time

1.     Stay Updated

Latest updates help you fix bugs that slow down your site. With each update, the contributing developers make WordPress faster, friendlier, and more secure.

WordPress typically rolls out 2-3 major version upgrades (recognizable by their jazz musician tribute names and numbers like 4.1, 4.2, 4.3…; we are currently on 4.4 “Clifford”). Your install does not auto-upgrade major versions.

Make sure you keep your WordPress core, plugins, and themes updated to the most recent stable release.

2.     Check Hosting

Most of the performance issues are of server-side origin. Make sure your chosen hosting has you covered in times of heavy incoming traffic, space, data transfers, high speed performance, etc.

Check the hosting plan you are paying for and see if it matches up to the highest estimated traffic and bandwidth requirements for your website. While WordPress minimum requirements are versions 5.6 for both PHP and MySQL, it’s better to make sure your server supports latest versions of both.

3.     Caching

In the age of feature-rich and content-heavy web pages, caching is your best friend.

On WordPress, it’s super-easy to use server side caching via free plugins like W3 Total Cache or W3 Super Cache. There are others, but you only need one for your purpose. Check the features before you install the plugin (for e.g. If you have don’t have a content delivery network (more on that in a moment), W3 Total Cache will let you set up and use MaxCDN).

If your caching plugin doesn’t take care of it, there are caching tools and scripts like Memcached and Redis that you can use to cache your database for super-fast load and query times.

4.     Module mod_expires

This Apache module lets your visitors’ browser take the burden of loading your web pages on subsequent visits. It lets you set expiry time of cache for specific file types on your website. You can either use it as a streamlined <ifmodule> like this…

For this, the following code has to be copied to the .htaccess file

<ifmodule mod_expires.c>
<Filesmatch “\.(jpg|png|gif|js|css|ico|woff|mp3|pdf)$”>
ExpiresActive on
ExpiresDefault “access plus 5 days”
</Filesmatch>
</ifmodule>

Or you can specify different times for each type with this:

ExpiresActive On
ExpiresByType image/jpg “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 5 days”

5.     Optimizing Database

database optimization

Like defragging a computer hard disk, optimizing your database helps in freeing up space and keeps the database running smoothly. This means a rigorous database cleaning and maintenance schedule.

You need to remember that WordPress database can get ‘clogged up’ from old post revisions, spammed and unapproved comments, duplicate or orphaned metadata, etc.

To fix this and improve query time, you can use plugins like WP Sweep or WP-DB Manager.

6.     Front-End Optimization

Remember how time is perceived differently by everyone? In human computer interaction terms, this is called perceived performance. Essentially, if your website looks like it has started working, the users are more likely to wait for the page to load fully.

This calls for some serious front-end optimization.

  • Image optimization should become a legal requirement by now, so do not skimp on compression and lazy load filters. Use plugins like Lazy Load XT, EWWW Image Optimizer, WP Smush.it, etc. to retain quality but reduce the weight.
  • You can (and should!) reduce the number of HTTP requests if you compile multiple images together into one by a simple process called CSS Spriting. There are tools like Sprite Pad which let you create CSS sprites from multiple images through a simple drag-and-drop interface. It goes without saying that sprites save a lot of time (for you and your visitors both).
  • Use the flush() function to make activate partial loading. Add this code to your php right after the opening </head> tag:

</head>
<?php flush(); ?>
<body>

Keep in mind: the function may interfere with some cache plugins like W3 Total Cache

7.     External video hosting

Instead of burdening your own server with high-res, heavyweight videos, use an external host.

This is an ideal alternative for you if your server’s has speed and space issues. You can host your videos through external services, such as Youtube, Vimeo, or other 3rd party video hosting providers.

Make sure to check how much control you get to retain over your video files (for editing, copyright, etc.) to avoid sticky situations later. Good video hosting providers usually come with a set of video management tools and features and offer support.

8.     Hotlink Prevention

Note: This is if you don’t have a CDN that takes care of preventing image hotlinking.

Hotlinking (or inline linkingremote linking etc.) is when a person uses images or other files directly from a website and embeds it into their own without storing it on their own server. For instance, if you upload an image and someone else just copies your image’s URL in their own content, they get to show your image as their own, without actually storing it on their own server.

If the person is using your files without your consent, it’s theft of your files as well as your server bandwidth (because they are linking to your image without giving you any credit or driving any traffic to your website).

Prevent this from happening with a code snippet that can be added to your .htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?my-website\.com [NC]
RewriteCond %{REQUEST_URI} !^/images/stopstealing\.jpg$ [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ http://my-website.com/images/stopstealing.jpg [NC,R,L]

9.     Dumping the trash

WordPress gives you the option to automatically get rid of the trash for you. Add this code to the wp-config.php file to automatically delete the trash every 10 days (and free up space for more important things like content).

define(‘EMPTY_TRASH_DAYS’, 10 );

Endnote

This is a quick round-up of simple measures you can put in place to speed up your pages. Optimizing your site can make a big difference in site speed, encouraging visitors to not bounce off and engaging viewers with your content. We hope that this guide will help you to make your site a little bit faster – if you only do one or two things listed that’s already great. Every little bit counts.

Tracey Jones

Tracey Jones is a front end WordPress developer at HireWPGeeks Ltd. where she provides Drupal to WordPress conversion service with her team of expert developers. She also happens to be a blogger who loves to write useful blogs and articles about technical stuffs and socialize it through social media platforms.