Optimize Slow WordPress Site

A slow WordPress site is about the worst thing you can expose your users to. What you need to concentrate on is the perceived load time, the time it takes for users to believe the site has fully loaded.

Websites comprise multiple DOM (document object model) elements such as HTML, JavaScript and CSS that add overhead to any website. They’re unavoidable. But knowing how to optimize them for speed is what counts.

Get the perceived load time down to an instant and your slow WordPress site will be a thing of the past!

What Causes A Slow WordPress Site?

Well, how long is a piece of string?

There’s no single cause for a slow WordPress site.

Poor speed is normally the culmination of a number of factors, that combined, result in a poorly optimized site.

Let’s take a closer look.

Poor Web Hosting – The #1 Cause Of A Slow WordPress Site

The WordPress Optimization Guide confirms that poor web hosting is the primary cause of a slow WordPress site.

Good hosting doesn’t have to be expensive but it does have to be fast.

I used to host my sites with Siteground who are excellent. But I switched to Cloudways because of Siteground’s excessive renewal costs.

While their semi-dedicated (GoGeek) plan can handle up to 100,000 visits per month at a regular cost of $35 per month, you can get a Cloudways plan for $11 per month that can handle way more than 100,000+ visits PLUS you get an incredibly fast stack that makes Siteground look as if they’re looking for parking!

All Cloudways plans include:

  • 24/7/365 Support
  • Free (Let’s Encrypt) SSL
  • CDN ($1 Per Month Add-on)
  • Free Migration
  • Unlimited Websites (Resource Dependent)
  • Dedicated Firewalls
  • 24/7 Real-Time Monitoring Built Into Dashboard
  • Automatic Daily Backups
  • On Demand Backups With Rollback
  • Staging
  • Optimized Stack With Advanced Caching
  • Auto Healing Of Servers
  • Regular Security Updates
  • HTTP/2 Enabled Servers
  • SSH and SFTP Access

TRY CLOUDWAYS FREE FOR 3 DAYS

Sign Up with Promo Code: WPMM25OFF for 25% off your first 2 months hosting fees if you decide to host with Cloudways.

RELATED READING: Cloudways Review PLUS Setup Guide.

Disable WP Cron

Much like the Windows Task Scheduler, WP Cron schedules tasks for your WordPress site.

The biggest problem with WP Cron is that it doesn’t run at predefined intervals but every time a page is loaded from your site.

Imagine how this is going to impact loading times on a busy website.

WP Cron can be replaced with a system cron which can be scheduled to run at predefined intervals, thereby reducing server load considerably.

Kinsta have written a very helpful post explaining how to disable WP Cron and set up a system cron.

Use A Fast Database

Pretty much dictated by your hosting but if you’re privileged enough to host with Cloudways I’d suggest you switch from MySQL to MariaDB. It’s noticeably faster.

Loading Unused JavaScript And CSS

Some plugins inject their code into every page and post of your site.

Certain themes do the same thing.

Asset CleanUp helps you to determine exactly what scripts and CSS are running and allows you to disable, on a per page / post basis, those which aren’t required, thus reducing the amount of code that needs to be parsed.

You’ll be surprised how much loading time this can shave off!

Too Many Or Poorly Coded Plugins

Some plugins are wonderful. But you must be mindful that they inject additional code into your WordPress installation and therefore add overhead to your site.

The easiest way to check out the extent to which a plugin slows down a WordPress site is to do a speed check both before and after installation. I did this with Jetpack and found that the plugin added a whole 13 seconds to my load time. Funny thing is I was only using the plugin for automated social media posting and comments so all the other setting were turned off.

Strangely enough, even well coded plugins aren’t always lightweight, but poorly coded ones will certainly slow your site down. Substandard coding creates buggy behavior and is often responsible for too many or unnecessary database calls (which we’ll get to later on) which make WordPress sites unncessarily slow.

I make it a habit to keep plugins to a bare minimum and I recommend you  deactivate and delete plugins that you don’t use. Personally, I take this a step further by accessing my cPanel file explorer and removing plugin folders that are left behind after deletion. It makes for a cleaner installation if nothing else. If you’re on cloud hosting, you’ll have to do this via SFTP.

Using code snippets is a great way to avoid plugins and the additional overhead they add. Just be sure to get them from a reputable source.

Lastly, make sure that the plugin you want to use is compatible with your version of WordPress.

Poorly Coded And Bloated Theme Choice

A fast, lightweight, well coded and optimized theme will most certainly outperform a bloated, graphic laden theme. That’s why I only use StudioPress themes running on the Genesis framework.

Besides the impressive list of features, the beauty of a proper framework is that the framework is the “engine” that powers the operation of the theme, which is essentially a “skin” with its own design and layout.

Improvements and updates can therefore be made to the framework without affecting the design of the theme which yoou can manipulate to get the look and feel that you want.

You can read more about the StudioPress themes and Genesis Framework in my StudioPress review.

We have seen themes which put 3x extra load to the server. Turned out it caused 3x more database queries – which is bad in itself. Then we found out that some of the queries are unoptimized. Not good.

WordPress Optimization Guide

StudioPress themes are probably the most widely used themes in the WordPress community and the funny thing is that they’re actually cheaper than most most other themes which don’t come close in terms of quality, features and speed.

They range in price from $99.95 to $129.95. This includes the cost of the Genesis Framework which has a value of $59.95. Your second theme onward are discounted and also don’t include the Genesis framework as that can be used on multiple sites, as can themes.

No Caching Or Slow Caching Plugin

Repeated requests for web pages from a server means more CPU usage and translates to a slowdown in server speed which can cause or exacerbate a slow WordPress site. Another reason why great hosting is imperative.

It’s way more efficient to store and serve static pages from a cache, thereby reducing server load and increasing speed.

This can improve performance several hundred times over for fairly static pages.

WordPress Optimization Guide

Because cached pages are readily available, they don’t need to be repeatedly retrieved (and built) from a database. They’re sent immediately to a user’s browser which improves page loading time tremendously.

This type of caching must not be confused with browser caching, although the best caching plugins include certain browser caching features such as expires headers, which we’ll get to shortly.

If you’re on shared hosting, caching is not negotiable. It’s essential.

Personally, I use WP Rocket and Swift Performance Pro on (on two different sites).

They are both really great plugins. Both sites use the same theme so it’s easy to compare the two directly. I achieve blazing fast load times with both of them.

WP Rocket is brilliant in terms of performance and ease of use.

Swift Performace Pro offers more granular control but you need to know quite a bit more about the technical aspects of caching to set it up properly.

If you’re looking for a free option, try W3 Total Cache but be forewarned that this plugin has around 9 different tabs with a multitude of settings, enough to scare even seasoned WordPress users.

The small investment in a premium caching plugin will save you endless hours of frustrating configuration and your time will be more financially effective if you spend it on generating income.

In my opinion, WP Rocket is the top caching solution in the WordPress universe. It’s a $49 investment that will pay for itself many times over.

Suggested Reading:

PHP Version And Accelerators

I’ve added this section here because this aspect of speed optimization is very closely related to caching.

PHP is a server side language and is the official language of WordPress.

Every single page that loads requires large amounts of PHP code to be “parsed” (executed).

Poorly coded (code heavy) themes and plugins, as well as too many plugins (as already mentioned), cause an exponential rise in the amount of PHP code which can add several seconds to each page load.

In many server environments (especially shared hosting), this “parse” time can greatly affect performance, adding several seconds to the total time it takes to finish loading a page.

WordPress Optimization Guide

A specific type of caching called OPCache, stores or rather caches the PHP content in a temporary cache which helps to avoid the need to parse PHP code too frequently. The stored code reduces parse time and is known as a PHP accelerator.

Each new version of PHP makes speed enhancements and for this reason it’s important to always keep updated with the most recent version.

And while OPcache is supported by PHP 5.5+ it has several more options available in PHP 7+ (along with generally faster PHP performance), so it’s a good idea to stay as updated as possible.

WordPress Optimization Guide

Browser Caching – Add Expires Headers

Expires headers invariably comes up in GT Metrix and Pingdom speed optimization suggestions.

Certain assets such as images, CSS and JavaScript don’t generally change very often. For this reason, it’s more efficient for them to be cached in a user’s browser, thereby preventing them from having to be sent from the server every time the same user visits your site.

By setting an expiry date for each asset type, the visitor’s browser will store these for a specified time so that the same information can be rendered almost instantly with each subsequent request.

This makes a tremendous difference to load time for repeat visitors. It has no bearing for new visitors.

Expires headers are added to the .htaccess file in your website’s root directory. Here’s an example of what they look like.

# Media
ExpiresByType audio/ogg   "access plus 2 months"
ExpiresByType image/gif     "access plus 2 months"
ExpiresByType image/jpeg   "access plus 2 months"
ExpiresByType image/png    "access plus 2 months"
ExpiresByType video/mp4    "access plus 2 months"
ExpiresByType video/ogg      "access plus 2 months"
ExpiresByType video/webm  "access plus 2 months"

WP Rocket automatically adds expires headers to your .htaccess file.

Enable GZip Compression On Server

As the name indicates, GZip compresses the size of your website files for quicker transmission and load time.

According to Varvy, this can save around 50% to 70% of the file size for HTML and CSS files.

Depending on the type of server, this is usually achieved by adding code to the .htaccess file or config file.

Here’s an example of a few random lines extracted from my .htaccess file.

<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "application/atom+xml"
"application/javascript"
"application/json"
"font/eot"
"font/opentype"
"image/bmp"
"image/svg+xml"
"text/css"
"text/html"
"text/javascript"
"text/plain"

WP Rocket automatically inserts GZip compression code into the .htaccess file.

Optimize Images

Unoptimized images eat into bandwidth and are a major cause of slow WordPress sites.

Saving images with the lowest possible file size – not necessarily dimension size – will maximize speed.

PNG image compression is lossless. This compression reduces the file size of an image without affecting image quality. Lossy compression, applicable to JPG, reduces file size and quality.

The JPG format allows for the greatest degree of bandwidth saving but most times you will be compromising between image quality and size. Nevertheless, it’s not difficult to produce very acceptable images whilst reducing file size multiple times.

Adobe Photoshop facilitates image compression at different quality levels and it’s good practice to get into the habit of optimizing images prior to uploading them to your website.

As a minimum, I recommend installing an image compression plugin which is used to compress images on upload. TinyPNG losslessly compresses both .png and .jpg images. The first 500 compressions per month are free and the cost for additional compressions, which is billed on a pay as you use basis (no monthly fees), is hardly worth talking about.

Swift Performance Pro includes an image optimizer that gives you unlimited image compression together with a handful of other image optimization tools for maximum speed, e.g. lazy loading, auto resizing and bulk image optimization.

Lazy Load Images

Lazy loading or deferring the loading of images until they enter the user’s viewport can make a vast difference to the first paint time (perceived load time) and also improves total page load time.

I’ve also found this to be very beneficial to improving / fixing CLS (cumulative layout shift) issues, one of Google’s new Core Web Vitals metrics. CLS will become a ranking factor during 2021 so definitely something to be aware of. You can check for CLS issues in your Google Search Console.

I have tested a number of lazy load plugins in the WordPress repository but honestly, the best lazy load feature I’ve found so far is included in WP Rocket.

The lazy load feature built into the Swift Performance plugin is also really good but it must be configured properly.

Prevent Image Hotlinking (Embedding)

Disabling WordPress embeds prevents 3rd parties from linking directly to your images on your site, for use on their’s.

This practice saves those 3rd parties from loading their own images onto their pages and in turn, consumes your bandwidth due to the images being loaded from your server.

If you’re a WP Rocket user, there’s an option to toggle this setting. Otherwise, add this code to your .htaccess file.

#Disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?facebook.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?twitter.com [NC]
RewriteRule .(jpg|jpeg|png|gif)$ – [NC,F,L]
# End image hotlinking

Make sure to replace yourdomain.com with your actual domain name.

Google, Facebook and Twitter are whitelisted. Add or subtract as you wish.

Minimize Media Embeds

While we’re on the subject of media, we may as well tackle media embeds.

What I’m going to mention next is something I say with trepidation because I believe that video is going to be up-ranked in Google SERP.

Other than that, media embedding slows down your website. It’s best for speed to minimize media embeds and rather keep them on Youtube and other media sharing sites. You can always add a link where necessary.

Use a CDN 

content delivery network can greatly reduce the load on your website’s server. Thy’re most effective when used with a caching plugin and serve a dual purpose really.

  1. To offload static assets such as images, JavaScript and CSS which reduces server load.
  2. To distribute content over multiple data centers around the globe, thereby reducing geographical distance for content delivery.

Cloudflare has a network of data centers around the world. Whilst it isn’t a “typical” CDN, they offer a free plan which allows for routing of your site’s traffic through their global network.

Add A Cloudflare Page Rule

If you run a static site, a “cache everything” page rule will propel your performance. Please don’t use this rule if you run a dynamic site such as an e-commerce site.

This rule does wonders for TTFB (time to first byte) and contentful paint time (perceived load time).

If you use this rule, please make sure to log out of your dashboard and then purge everything in Cloudflare > Caching otherwise your users will see the admin ribbon on your live site.

Offload Static Assets To Multiple Subdomains

Depending on your hosting and caching, there may be some speed improvement by offloading and distributing static images, JavaScript and CSS files between multiple subdomains.

This also alleviates the alerts in GTMetrix to serve static content from cookie free domains.

Browsers are limited in the number of requests that can be made to a server at one time. Most can only make 2 requests simultaneously.

If the total number of files required to render a page can be retrieved from say 3 or 4 different hostnames, more requests (and retrievals) can be made simultaneously. Obviously this reduces the time it takes to retrieve all the information required to render a page, with the concomitant reduction in load time.

Optimize Or Disable Gravatars

Each gravatar that appears in your comments must be fetched from an external server. So 50 comments means 50 external HTTP requests. And it’s not just the additional requests that add overhead to your site. Your site speed is also  dependent on the speed of the gravatar.com server.

Heck, it’s not surprising there are so many slow WordPress sites.

Here are 3 ways to handle gravatars.

  1. If speed matters to you (which is why you’re here) it’s best to turn them off completely.
  2. If you absolutely must have them on your site, you should cache them with Swift Performance. Unfortunately, WP Rocket doesn’t cache gravatars – yet.
  3. Thrive Comments is a paid commenting system that’s built on the native WordPress comments system. It’s the best 3rd party commenting system I’ve come across so far. They have options to lazy load the entire comments window meaning that your page will fully load before the comments do. You can also choose to have the comments show only once they come into the viewport (i.e. when the user scrolls to comments).

Use A Fast Commenting System

Admittedly, the native WordPress commenting system lacks attractiveness and certain elements that make top commenting systems engaging for users.

But truth be told, it’s still the fastest commenting system.

I’ve literally spent hundreds of hours researching and testing commenting systems for speed and engagement.

Here are my results:

  1. WordPress native comments is the fastest.
  2. Disqus is the most engaging but it’s infamous for slowing up WordPress websites.
  3. Thrive Comments is the best 3rd party commenting system. There are options to enhance loading times with lazy loading and it’s engaging too. Users can also subscribe to comments which they can’t do with the native WordPress system. Only thing is it will set you back $39 (once off).

If you want to make the native WordPress commenting system look cool, try this CSS.

/* Comments (WordPress standard comment system) */
.comment-respond,
.entry-comments,
.entry-pings {
margin-bottom: 100px;
padding: 20px 45px 40px 45px;
border: 1px solid #ccc;
overflow: hidden;
background: #F5F5F6; /* my colour */
-webkit-box-shadow: 0px 0px 8px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 0px 8px rgba(0,0,0,0.3);
box-shadow: 0px 0px 8px rgba(0,0,0,0.3);
/* border-left: 2px solid #444; */
}

p.comment-meta,
.entry-comments .comment,
.entry-comments .comment-reply {
margin-bottom: 40px;
/* my edit */
font-size: 14px;
font-size: 1.4rem;
/* end */
}

.comment-header {
/*
font-size: 20px;
font-size: 2rem;
*/
font-size: 18px;
font-size: 1.8rem;
}

.entry-comments .comment {
border-bottom: 1px solid #000;
}

.comment-content,
.entry-comments .comment {
clear: both;
font-size: 16px;
font-size:1.6rem;
}

p.form-submit,
.entry-comments .children .comment,
.entry-comments .comment-author {
margin: 0;
}

.entry-comments .children .comment {
border: none;
}

.comment-respond label {
display: block;
font-weight: 700;
/* My edit */
font-size:18px;
font-size: 1.8rem;
}

.comment-respond input[type="email"],
.comment-respond input[type="text"],
.comment-respond input[type="url"] {
width: 100%;
}

.comment-list li,
.ping-list li {
list-style-type: none;
}

.entry-comments ul.children {
margin: 0px 20px 40px 40px; /* my edit */
background-color: #fff; /* my edit */
}

.comment-list .children {
margin-top: 40px;
border: 1px solid #ccc;
}

.form-allowed-tags,
.ping-list .reply {
display: none;
}

p.comment-notes {
font-size:18px;
font-size:1.8rem;
}

p.logged-in-as {
font-size: 18px;
font-size: 1.8rem;
}

/* my edit
.title-reply {
font-size: 20px;
font-size: 2rem;
font-weight: 500
}
*/

textarea#comment {
background-color: #fff;
border: 1px solid #ddd;
/* border: none; */
color: #000;
font-size: 14px;
font-size: 1.4rem;
font-weight: 400;
padding: 16px;
width: 100%;
}

ol.comment-list {
margin: 0;
padding: 0;
border: 1px solid #ddd;
/* background-color: #fff */
}

.avatar {
background-color: #F5F5F5;
border: 1px solid #DDDDDD;
border-radius: 50% 50% 50% 50%;
/* padding: 4px; */
}

Split Comments Into Pages

Too many comments on your post can really hurt your loading speed.

Luckily WordPress makes it easy to split comments into pages. You can choose how many top level comments to display on any one page by changing the discussion settings from your dashboard.

Only activate this setting when it becomes necessary, otherwise Yoast SEO will tell you to switch it off.

Avoid Google Maps On Your Site

Besides the fact that maps contain an awful amount of data, they must also be fetched from Google servers creating an additional HTTP request.

Moreover, if Google servers become slow, so does your loading time.

Steer Clear Of Ad Networks 

All well and good to want to monetize your site. Ad networks such as Google Adsense and Mediavine require high traffic sites to be profitable.

Besides these making calls to external servers, not all of which are optimized for speed, the combination of the added HTTP requests and high traffic will not only make your WordPress site slow, it can literally bring your site to a standstill.

Limit Revisions

WordPress stores every saved draft or update to a published post in the site’s database.

It doesn’t simply add the changes to an existing post in the database. The entire post gets re-saved with each revision.

So 3 revisions of a 3000 word post leaves 9000 words in the database. Imagine a blog with 1000 posts!

As the database grows in size, each query will take longer, causing your site to slow down.

I limit my revisions to a maximum of 3, by adding the following line to my wp-config.php file, above the ASBPATH code:

define('WP_POST_REVISIONS', 3);

All future posts will be limited. But what about all the existing revisions to date?

If you want to clean up right now, you can download Optimize Database After Deleting Revisions from the WordPress repository.

However, WP Rocket includes a database cleaner allowing you to clean up revisions, thereby preventing you from having to use yet another plugin.

Merge Scripts

It doesn’t matter whether you’re trying to speed up a slow WordPress site or further optimize a quick one, merging scripts makes a substantial difference to speed by drastically reducing the number of HTML requests from the server.

Because of this, it even speeds up page loading on HTTP/2 servers (which are highly optimized anyway) whilst saving valuable server resources in the process.

I’ve tried a number of really great optimization plugins (e.g. Autoptimize) in the past but WPRocket does it effortlessly.

Load Scripts Asynchronously

When scripts are merged, the full merged script must be loaded before any individual one can run. Obviously this delays scripts at the top of the queue.

The Async option splits the merged scripts on the client side allowing each one to run immediately upon loading. This works together with merging and is another one of Swift’s ingenious features.

This makes a huge difference to the perceived load time and enhances user experience greatly.

You see scripts are, what we call, render blocking. Let me explain.

When an HTML page is loading, any scripts that are met along the way actually block the parsing of the HTML code (and hence the loading of the page) until they are retrieved and executed themselves.

Async loading means that the parsing of the HTML does not need to pause to fetch and execute a script. The HTML can continue to execute and the page can continue to load. The script will execute in parallel with the HTML as soon as it becomes ready to do so.

Whilst Async loading doesn’t really defer the parsing of JavaScript, it’s more effective for speed and perceived performance than deferring scripts to the footer.

Minify Scripts

Minification removes any white space from scripts thereby reducing file size and enhancing speed.

It doesn’t affect the functionality in any way.

Lazy Load / Defer Scripts

This will delay loading of the particular script until last. In fact, the script will only run when the user first interacts with it, e.g when it comes into the viewport or when a mouse button is clicked.

This is pretty much the same as deferring the parsing of JavaScript.

Because the selected scripts don’t run when the page is first loaded, it decreases loading time. Another great feature of WP Rocket.

Merge CSS

Merging CSS can break your website. You can always reverse the process but it’s important that you test this on your your website and your specific installation.

This works in exactly the same way as merging scripts. Merging CSS reduces the number of requests and therefore decreases load time, even on HTTP/2 servers.

WP Rocket takes care of this seamlessly.

Generate Critical CSS And Print It Inline

As with scripts, CSS is render blocking.

Critical CSS is a part of the CSS that is critical to load the “above the fold” content of the site. This could also be called “Above The Fold CSS”.

Loading the critical CSS inline (in the <head> section of the site) makes the above the fold content and styles load very fast as it’s readily available and doesn’t have to be fetched from a separate file. This makes the page load without interfering with the render path and obviously improves the contentful paint time or perceived load time.

The rest of the css can be loaded as normal or even deferred by moving it to the footer.

This ensures that your WordPress site isn’t slow to load, thereby retaining visitors, increasing traffic, conversions and income.

Doing this manually requires hand coding and is time consuming. WP Rocket has done all the heavy lifting already. It automatically generates critical CSS to prevent render blocking. All you need to do is let the plugin take care of this for you.

Minify CSS

The same as for scripts, minification removes white space from the CSS thereby reducing file size. This doesn’t affect functionality.

Host Google Analytics Locally

Google analytics requires a small script to be placed  on every page of your site. This will ideally be placed in the head section.

This invokes a DNS lookup and obviously has a negative impact on speed.

One way to improve performance is to place the script in the footer. This alleviates any render blocking. However, this isn’t ideal.

WP Rocket will host Google Analytics locally, thereby alleviating any speed shortcomings. And because it’s hosted locally, it also solves the “leverage browser caching” alert in Pingdom and GTMetrix.

Combine And Enqueue Fonts

As a general rule of thumb, Google, Adobe and other fonts represent about 3% of the total weight of a web page.

Combining fonts saves repeated requests for them meaning that they’re all fetched at the same time from the external server, thereby reducing overall time.

Importing Google fonts into your theme by adding @import in your stylesheet is really easy but this method prevents parallel downloading, thereby adversely affecting speed.

It’s better to use the standard method by adding the following to the head section of your pages.

<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">

The only problem with this method is that you have to either add this to your header.php file (before your main stylesheet) or your theme must provide a way to allow you to add code to the head section of your website.

If you use the Genesis Framework, you’re in luck because the developers take care of combining and loading of fonts within the code to optimize the process as much as possible. Here’s what the code looks like when fonts are combined and enqueued. The pipe operator (|) separates each combined font.

wp_enqueue_style( 'infinity-fonts', '//fonts.googleapis.com/css?family=Lato:400,400i,700|Roboto:700', array(), CHILD_THEME_VERSION );

WP Rocket has an option to combine Google fonts.

Host Fonts Locally And Adopt A Font Loading Strategy

I’ve tested extensively and found that (for me) hosting fonts locally definitely improves speed. It cuts out multiple external server requests and eliminates the DNS lookup. And combining this with a meaningful font loading strategy makes a substantial difference to user perception (perceived load time).

I’ve dedicated an entire post that goes through the why and how to setup local font hosting as well as a layman’s guide to font loading strategies.

Switch To System Fonts

This made a huge difference to the way my site loads. And my site looks darn smart too!

System fonts are pre-installed on the user’s operating system and require no download time by the browser.

Furthermore, because fonts are required for text to be displayed, system fonts alleviate FOIT and FOUT altogether.

Follow my in depth tutorial on how to use a system font stack to do the same for you.

Remove Query Strings From Static Resources

This is another one of those alerts you’ll see in GT Metrix. Most CSS and JavaScript files have a version number appended to the URL.

The URL will normally look something like this: yourdomain.com/style.css?ver=2.1. A query string always contains a ?

WP Rocket will normalize these static resources by removing the query string.

If you’re not using WP Rocket (yet), add the following code to your functions.php file.

function _remove_script_version( $src ) {
$parts = explode( '?', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );

Disable Emojis

According to Pagepipe, emojis add 2 to 3 HTTP requests to a site, with a page weight of 5.6k to 14.7k.

There’s a plugin, of course, to disable them but then you’re adding the weight of an additional plugin to your site. Bad idea.

The best way to disable them is with WP Rocket. This is just such an amazing plugin. I mean how many plugins have we avoided so far with this Swiss Army Knife?

Minimize Redirects 

If you’ve ever changed your site’s domain you’ll know first hand that if you want to retain your rankings in SERP you’ll have to create a redirect from all of the posts and pages on the old domain to all of the matching pages on the new domain.

It’s the same as changing your postal address if you move home.

These 4 small lines of code inserted into your .htaccess file are a prerequisite to retaining your rankings with Google when changing address.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ https://www.newdomain.com/$1 [L,R=301,NC]

Nifty isn’t it?

Inasmuch as it’s efficient, the difference it makes to the speed of your site is significant.

It’s like ringing up your ISP to complain about a slow internet connection. After explaining in full detail to the technician what you’re experiencing, you’re told that you need to be transferred to higher level of support. And after your lengthy spiel to level 2 support, they have to pass you up to level 3.

Same waste of time when redirecting website visitors!

The same kind of redirect is used if you change a URL. It’s still a 301 redirect except that you don’t do this from .htaccess.

If you’re on shared hosting and you only have 1 or 2 redirects, you can do this from cPanel. This saves you having to use a plugin. Any more than that, I’d suggest you use a plugin like Redirection.

The best solution is to avoid redirects as much as possible.

Reduce Database Calls With Memcached

Memcached is open source software that is deployed to reduce the number of times a database must be read by storing data in memory thereby making it readily available for multiple use.

If you host with Cloudways, Memcached is included and activated in the server setup.

Use Redis Cache

Redis works in a similar way to memcached but it’s faster and more efficient.

Redis is included as a free addon with Cloudways. It’s easy to install and makes a marked difference to performance.

Show Only Post Exerpts On Archives Pages

Besides being at risk for duplicate content and a possible Google penalty, full posts on archives pages makes your pages really slow to load.

Furthermore, it becomes difficult for visitors to scroll through your postings, which is really bad for user experience.

Showing excerpts solves both speed and UX issues.

Eliminate Social Sharing Plugins

I’m not going to be very popular in the eyes of the social giants, but here goes.

Social sharing plugins can have a profound effect on performance optimization with most being responsible for thousands of slow WordPress sites.

Depending on which plugin is used, the additional JavaScript and number of requests can easily weigh down a page by over 1 second.

Check out this speed test with Social Warfare (a very lean social plugin) installed.

And without the plugin.

The full load time is neither here nor there. But that’s not important when it comes to speed testing. Let’s take a look at the important metrics.

Metric (Times)WITH Social WarfareWITHOUT Social Warfare
Time To First Byte (Server Response)176ms58ms
Contentful Paint (Loading)255ms161ms

On a different note, because discussions are transported to Facebook, Twitter and the like, you must also weigh up the cost of lost engagement on your own site.

If you really must have them, consider the fact that almost 100% of mobile users never use them. And if you still must have them, make certain it’s a lightweight plugin and please do speed testing before and after adding the plugin.

Disable Unused Plugin Modules

Certain plugins, such as page builders, include a number of modules. Examples include counters, galleries and embeds.

JavaScript keeps these modules running so disabling those you don’t use will effectively reduce the amount of script and therefore improve speed.

Don’t Use Sliders

According to Yoast and Search Engine Land, sliders negatively affect speed and SEO.

They slow down your site, negatively impacting your SEO and conversion rate

Yoast

In fact, Google went so far as to introduce an algorithmic update in around 2012 that affected sites with little or no content above the fold.

A slider at the top of your site pushes any meaningful content below the fold.

If you absolutely must use one, make sure you choose a lightweight slider such as Soliloquy.

Use A Fast Gallery Plugin

As you know, images must be properly optimized. Remember you’ll be putting a number of them together in a gallery.

Additionally, in order not to extirpate your SEO and speed optimization efforts, a fast gallery plugin like Envira or Modula is essential.

Limit Your Hosting Account To One Website. 

Hosting providers cleverly market their plans to accommodate more sites per account as the price steps up.

But each hosting account comes with a certain pre-allocated amount of resources.

Hosting multiple sites on one account is great if you don’t have complex, high traffic sites that consume greater resources. But in reality, more than one site per hosting account is going to make all of your WordPress sites slow.

Use A Lightweight SEO Plugin – Rank Math

Rank Math SEO is just over a year old and it’s gaining momentum fast.

Not only is it well coded, using only 30,500 lines of code to achieve way more FREE functionality than Yoast offers with 43,300 lines of code, but this also makes it faster, having a very positive effcet on site speed. Furthermore, it’s 100% bloat free.

My Rank Math SEO guide is the most comprehensive tutorial available on the internet and will help you to set it up with optimal settings for speed. It also provides a full post optimization guide.

Summary

I hope you’ve found this post useful and that you’ll now apply what you’ve learned to outrival  your slow WordPress site.

If there’s anything else you feel I should include in this post, please let me know in the comments.