Speed up and optimise WordPress

 In Google, Web Development, Website Performance, WordPress

Diagnose and fix slow load times by using the latest server tech and asset optimisation plugins.

WordPress began as a simple blogging platform but evolved into the content management system that now powers a large percentage of websites. As the most popular content management system, its rapid success is likely down to it being fantastic general-purpose tool in the web development world.

A low barrier for entry and large ecosystem of plugins and themes allow less technically proficient users to build complex systems. But This can be a double-edged sword if a platform built in WordPress gains traction, scaling beyond the occasional visitor and leading to problems.

The first signs of trouble appearToo when a new user lands on the website load times can be excruciating and elements jump around the page as separate stylesheets load, one by one. It isn’t long before the server runs out of memory, causing the database to crash, requiring a server restart to bring the website back up.

By default, when a user lands on a page provided by a WordPress website, the back end runs through the theme and any plugins before rendering the page. If lots of plugins are used or the theme is poorly written, this can result in lengthy database queries and inclusion of JavaScript and CSS where it isn’t needed. Thankfully, many of the major issues causing a slow speed can be addressed, and in this tutorial we will look at how you can optimise even the clunkiest of WordPress websites.

Test the current speed.

The first step in speeding up a website is to find out how well it’s performing to start with. An array of tools exists to help with this including Google’s Pagespeed Insights and Pingdom’s page load checker. We will be using GTmetrix as it combines several checks. Go to gtmetrix.com and enter the URL for the website.

Examine the results

After a short delay GTmetrix will display the results of the check and give several scores from A – F. It will also give a fully loaded time and a total page size. Below this, a breakdown of several elements is given.

.Identify the largest files

One of the most important metrics is the total page size. This is the filesize of all loaded elements on a page, such as images, video, CSS and any scripts that are included in the page. Using GTmetrix, open the waterfall tab and sort the table by size to find the largest elements on the page.

Compress media to reduce size

Images and videos are usually the largest items on a page. Eliminate unnecessary background videos and ensure to encode video at a low bit-rate if it plays automatically, Install the plugin EWWW Image Optimizer. From the media library a new bulk optimise option is available. Run this.

Resize Images

Sometimes images added to a page are at a high resolution and then scaled down with CSS. This wastes bandwidth as the larger size is never used. Go to the dashboard > Setting > EWWW Image Optimizer and select resizes. Tick “Resize detection”. Now, pages viewed by an admin will highlight images that need to be resized. Resizing these images in an image editor or using a CDN with automatic sizing will fix this issue.

Minification of CSS, JS & HTML

This is the process of removing the characters in code that make it human-readable to reduce the size of the page. When using a third-party theme, a plugin such as Autoptimize is perfect for this. Install it, go and tick “optimise CSS code”. When working with a theme that has been custom-made, minification is done with build tools such as gulp.

Combine CSS & JS files

When using a third-party theme the Autoptimise plugin can cover most scenarios by enabling the “Aggregate CSS files” option. This combines all the CSS for each page into a single file instead of many smaller ones.


a {

webkit-box-shadow: none;

text-decoration: none;





Defer external JavaScript

Live chat, analytics and tracking tools can bundle large JavaScript files that add entrie seconds to the time the page take to become interactive. Add the defer attribute to these scripts so that they’re not excluded until the DOM has finished loading

<script src=”path-to-file.js” defer></script>

Examine the plugin

Too many plugins can cripple WordPress. With so many plugins being free, developers are under pressure to push premium versions of their software and include unnecessary, bloated features such as pushing notifications to the admin dashboard. Disable and remove any plugins that aren’t being used- they can be installed again later if needed again.

10.Check web server power

The engine of a website is the server it runs on. If its cheap, underpowered and badly maintained it will run poorly. Go to https://developers.google.com/speed/pagespeed/insights and enter the URL of the website. In the results look for “reduce server response time”. If this appears on the report it’s likely that a slow server is to blame for the performance.

Enable Gzip compression

Gzip can decrease the size of your website before it’s sent to a user. The user’s web browser then decompresses the data automatically and displays it to them. With no drawbacks, it’s important to ensure Gzip is enabled. There are several tools to check whether Gzip is enabled, for example giftofspeed.com/gzip-test

Upgrade to PHP 7

Within the WordPress dashboard open Tools > Site health and click the info tab. Open the “Server” accordion and check the value for the PHP version. If this is less than 7.X.X it is highly recommended to upgrade to at least PHP 7.1. Tests show changing this allowed handling of over double the simulated visitors.

Set up caching

Go to plugins > Add new plugin and search for “cache enabler”. This lightweight plugin stores pages in a cache so a visitor browsing at the same time as another doesn’t cause the website to render the page twice. Instead, the plugin renders the page to a static HTML file once then servers this files to subsequent users.


Different devices render images at different sizes, making it difficult to size images exactly as they display. Using the free “photon” service, included in Jetpack images are automatically served at the right size.

Set up browser caching

Browser caching tells a user’s browser that certain elements don’t need to re-download every time they reload a page on the website or come back and visit again. This can be done manually in .htaccess, or alternatively a plugin such as “Leverage Browser Caching” can be used.

Load testing with virtual users

To simulate real users using the website and put the website under stress, load testing should be conducted. While monitoring the server for load impact, use a service such as loader.io to send traffic to the website. The CPU and memory of the server should stay within safe limits.

Recheck performance

Once the optimisation have been carried out, you should test and gauge the improvement to the website. Run GTmetrix again and use the history tab to see the difference in page load time. If caching has been enabled, make sure that you visit the website at least once in order to “prime” the cache before carrying out testing.

Recommended Posts