The Complete Guide to WordPress Speed Optimization

Speed is important for user experience and Google also love fast websites. Talking about website speed is something we continually do to encourage website owners take advantage of the benefits of a fast loading website. So today we’re going to share with you everything we know about speeding up your WordPress website, all in this one ultimate guide. Whether you’re just starting to use WordPress or are a seasoned developer, you’ll find something useful in this post!

Over 34% of the web is now powered by WordPress. While this is awesome, it also means there are thousands of different themes, plugins, and technologies all having to coexist. For the everyday WordPress user, this can quickly turn into a nightmare when their site starts to bottleneck and they don’t know why or even where to start troubleshooting.

Today we’ll be diving into applicable steps you can take right now to see speed improvements on your own WordPress sites. We’ll also share some resources that have been invaluable to us.

 

Further reading:


Here are the areas we cover in this post:

  •     WordPress Site Types: Static or Dynamic
  •     Choose High-Performance WordPress Hosting
  •     Choose a Server Closest to Your Visitors
  •     Premium DNS is Better Than Free DNS
  •     Your WordPress Theme Matters
  •     The Lowdown on WordPress Plugins
  •     Optimal WordPress Settings
  •     Why Cache Is so Important
  •     Image Optimization Is a Must
  •     Fine-Tune Your Database
  •     Use a Content Delivery Network (CDN)
  •     Offload Media and Email When Needed
  •     How to Find Bottlenecks and Slow Plugins
  •     Recommendations on Back-End Optimization
  •     Tips on Front-End Optimization
  •     Always Optimize with Mobile-First in Mind

 

Further reading:

 

WordPress Site Types: Static or Dynamic

Before we dive into the optimizations, it’s important first to understand that not all WordPress sites are the same. This is why a lot of users have problems, as you can’t go about tackling every issue the same way. We always give WordPress sites a classification: static or dynamic. So let’s first explore the differences between these two types of sites.

Mostly Static Sites

Static would typically include sites such as blogs, small business sites, lower volume news sites, personal, photography, etc. By static, we mean that the data on these WordPress sites is not changing very often (perhaps a couple of times a day). Even most of our sites would be considered a static website.

This becomes incredibly important as many of the requests can be served directly from cache on the server at lightning fast speeds! We’ll dive into the topic of caching in length further below. This means they will have fewer database calls and not as many resources will be needed to achieve google performance.

Highly Dynamic Sites

On the flip side, we have highly dynamic sites. These include sites such as eCommerce (WooCommerce or Easy Digital Downloads), community, membership, forums (bbPress or BuddyPress) and learning management systems (LMS). By dynamic, we mean that the data on these WordPress sites is frequently changing (server transactions are taking place every few minutes or even every second). This means that not all requests to the server can be served directly from cache and require additional server resources and database queries.

These sites also typically have a large number of concurrent visitors and sessions. On an informational or corporate WordPress site which is mostly static, a visitor might stay for five or 10 minutes until they find what they need (and this is a high number, usually bounce rates are much higher). On dynamic sites, you have the opposite happening. Visitors typically come to the site to engage with something or someone. If they’re going through an online course, it’s not unusual for them to stay for hours.

You can see where this is going. The concurrent visitors connected to your WordPress host adds up fast. To make it worse, you then have a large number of concurrent visitors on top of an “uncacheable content” problem.
You can't treat all WordPress sites the same when it comes to performance. Static and highly dynamic sites are two very different beasts!

 

Further reading:

 

Choose High-Performance Web Hosting

A web host is a company that stores all of your website’s data. You sign up for a plan and all your images, content, videos, etc., reside on a server sitting in the host’s data center. The web host gives you an easy way to access the data, manage it, and route it to your visitors. That sounds pretty simple but not quite. Let us explore further.

There are three very different types of WordPress hosts you’ll encounter around the web. Let’s dive into the pros and cons of each. It’s important you choose the right one from the beginning, otherwise, you’ll simply cause yourself headaches and wasted time down the road.

1. Shared WordPress Hosting

The first and most popular type of WordPress hosting is what we call “shared hosting.” These include the largest hosts in the industry. They typically utilize cPanel.

Anyone using this type of hosting will at some point experience slowness, it’s just a matter of time. Why? Because shared hosts tend to overcrowd their servers, which in turn can impact the performance of your site. Site suspensions or seeing frequent 500 errors are common things you’ll experience as they have to place limits on everything and consolidate resources to survive. Or even worse, website downtime. Even though you don’t know it, your WordPress site is most likely sitting on the same server as 200+ other people. Any issues that pop up with other sites can trickle over into your site.

Most of these hosts offer what they call their “unlimited resources” plan. You have probably all seen this. Well, there is no such thing in the real world as unlimited resources. What hosts do behind the scenes is throttle the clients using up a lot of the resources. This, in turn, ends up with those angry clients leaving, making room for more clients that don’t use a lot of resources. In the end, you have a vicious cycle of the hosting company pushing cheap plans and signing up customers who they hope won’t use a lot of resources and will purchase upsells lie SSL.

Customer service and support with shared hosting are almost always less than expected due to the sheer volume of sites vs. support representatives. Shared hosts have to spread themselves very thin to even make a profit and this usually leads to an unpleasant experience for the client. When it comes to shared hosting, you usually get what you pay for.


2. DIY VPS WordPress Hosting

The second type of WordPress hosting is DIY VPS, or “Do it yourself on a virtual private server.” This crowd is typically made up of bootstrap startups and users with a little more development, server management, and WordPress experience. They are the DIY crowd. These folks are typically still trying to save money, but they are also usually concerned with performance and realize its importance in the success of their business. Commons setups might include using a third-party VPS provider along with a tool to manage it more easily.

A small VPS starts at $5 a month. So depending on your setup, you could be looking at a cost of between $5 to $15 or more a month. The DIY approach can cut costs, but it also means that you are responsible if something breaks, and for optimizing your server for performance.

The DIY approach can be great, but it can also backfire on you if you aren’t careful. Don’t go this route if you aren’t tech-savvy or just because you want to tinker! Your time is worth money and you should be spending it on growing your business.

3. Managed WordPress Hosting

The third type of hosting is what we offer at Todhost and that is managed web hosting. These types of hosts handle all the back-end server related tasks for you, along with providing support when you need it. They are typically fine-tuned to work with WordPress and usually include features such as one-click staging environments and automatic backups. Their support teams will be more knowledgeable when it comes to knowing their way around the CMS as they are focused on one platform on a daily basis.

If you want to save time, managed web hosting is the way to go!

To learn more about why you should choose Todhost for managed web hosting, read why choose us – how Todhost is different. But regardless of which web host you choose as your hosting provider, you should always look for these following server features to ensure your website runs as fast as possible.

 

PHP 7 or Higher for the Best Performance

PHP is an open-source, server-side scripting and programming language that’s primarily used for web development. The bulk of the core WordPress software is written in PHP, along with your plugins and themes, which makes PHP a very important language for the WordPress community. You should ensure your WordPress host offers at least PHP 7 or higher.

There are different versions of PHP that your host will provide you on your server, with the newer PHP 7.3 offering huge performance improvements.

In fact, in our recent PHP benchmarks, if you compare PHP 7.3 to PHP 5.6, it can handle 3x as many requests (transactions) per second! PHP 7.3 is also on average 9% faster than PHP 7.2. This can also impact your WordPress admin dashboard responsiveness.
 

Faster speeds plus improved security, is why Todhost always offers the most recent versions of PHP. You can change PHP versions with a single click in cPanel using the MultiPHP Editor function.

And be wary of any WordPress hosts offering HHVM as an alternative to PHP. HHVM is no longer a suitable solution for WordPress hosting.


Your Host’s Network Matters

When choosing a WordPress host you might not even think to ask or research into what network they’re using, but you should. The network can have a huge impact on your site’s performance and even the snappiness of your WordPress dashboard. Many hosts will leave this out of their marketing as they’ll opt for the cheapest network to cut costs.

Here are a few questions you should be asking:

    Which networks are you transmitting data over? Is the majority of it over public ISP networks or private infrastructures such as Google or Microsoft? These big providers have networks which are built and optimized for low latency and speed. They even have their own internet cables under the ocean!
    Are the networks you’re using redundant? What happens if a cable is accidentally cut? This happens more often than you think.

Back in 2017 Google announced their standard tier network, which is a slower network but at a cheaper cost. At Todhost, we utilize premium tier network for all of our hosting plans. While this is an extra cost for us, it ensures you get lightning fast speeds.

How much of an impact does this have? Well, for data traveling across continents, their premium tier network is about 41% faster, on average, than the standard tier network. For data traveling to a nearby region (same continent), the premium tier is about 8% faster. While networking only makes up a fraction of your total page load times, every millisecond adds up!

As you can probably tell by now, a lot is going on behind the scenes when it comes to networking. Make sure your WordPress host is using a reputable one and aren’t opting for the lower tiers to cut costs.


HTTP/2 is a Must-Have

HTTP/2 is a web protocol released in 2015 which was designed to speed up how websites are delivered. Because of browser support, it requires HTTPS (SSL). If your WordPress host doesn’t support HTTP/2 you should start looking for a new provider. With the move of the entire web to HTTPS, this is no longer just a nice feature to have; it’s a necessity.

The improvement in performance with HTTP/2 is due to a variety of reasons such as support better multiplexing, parallelism, HPACK compression with Huffman encoding, the ALPN extension, and server push. There used to be quite a bit of TLS overhead when it came to running over HTTPS, but this is now a lot less thanks to HTTP/2 and TLS 1.3.

Another big win with HTTP/2 is that with most WordPress sites you no longer need to worry about concatentation (combining files) or domain sharding. These are now obsolete optimizations.


Choose a Server Closest to Your Visitors

One of the very first things you should do when hosting your WordPress site is to determine where the majority of your visitors or customers are coming from. Why is this important? Because the location at which you host your website plays a significant factor in determining your overall network latency and TTFB. It also impacts your SFTP speeds and WordPress admin dashboard responsiveness.

Network Latency: This refers to the time and or delay that is involved in the transmission of data over a network. In other words, how long it takes for a packet of data to go from one point to another. Nowadays this is typically measured in milliseconds; however, it could be seconds depending upon the network. The closer to zero the better.

TTFB: This stands for time to first byte. To put it simply, this is a measurement of how long the browser has to wait before receiving its first byte of data from the server. The longer it takes to get that data, the longer it takes to display your page. Again, the closer to zero the better.

We won’t bore you with all the technical details in this post, all you need to know is that you want your network latency and TTFB to be as low as possible. One of the easiest ways to accomplish this is to choose a server closest to your visitors. You can determine the best location by following the tips below.

Tip 1 – Check the Geolocation of Your Visitors in Google Analytics

One of the very first things you can do is look at the geolocation of your visitors in Google Analytics. You can find this under “Audience → Geo → Location.”


Tip 2 – Check Ecommerce Data

If you run an eCommerce store, make sure also to check to see where your customers are coming from. This is of course how you generate revenue, so these are your most important visitors. This should coincide with your traffic above; however, this is not always the case. If you have eCommerce data setup or goals in Google Analytics, you can easily overlay that information on top of the geolocation data to make a more informed decision. Or check location information stored in your eCommerce platform’s database.

Tip 3 – Do a Quick Latency Test

There are a lot of handy free tools out there to measure latency from your current location for different cloud providers. This can help you quickly evaluate which region might be the best choice for your site.

    GCP Ping (measure latency to Google Cloud Platform regions, including Kinsta servers)
    CloudPing.info (measure latency to Amazon Web Services regions)
    Azure Latency Test (measure latency to Azure regions)


Additional Ways to Reduce Latency and TTFB

Beyond choosing a close server location, here are a few other ways to reduce latency.

  •     Implement caching on your WordPress site. In our tests caching reduced our TTFB by a whopping 90%!
  •     Utilize a content delivery network (CDN) to serve cached assets from POPs around the globe. This helps negate the network latency for visitors who might not be close to your host server.
  •     Take advantage of the HTTP/2 protocol to minimize the number of round trips, thanks to parallelization. HTTP/2 is enabled on all Kinsta servers.
  •     Reduce the number of external HTTP requests. Each of these can have their own added latency based on the location of their server.
  •     DNS plays a part in TTFB, so you should use a premium DNS provider with fast lookup times.
  •     Utilize prefetch and prerender to perform tasks behind the scenes while the page loads.


Your visitors and customers should always be your priority. But another aspect of performance that many don’t talk about is how some of these decisions affect your day to day work. The data center location you choose has an impact on how fast your SFTP download and upload speeds (transferring files with an FTP client) are, as well as the responsiveness of your WordPress admin dashboard.

So while you want to make sure and choose a location that is best for your visitors, also keep in mind that it can affect site management. Tasks like uploading files to the WordPress media library will be faster when your site is hosted on a data center closer to you.


Premium DNS is Better Than Free DNS

DNS, short for Domain Name System, is one of the most common yet misunderstood components of the web landscape. To put it simply, DNS helps direct traffic on the Internet by connecting domain names with actual web servers. Essentially, it takes a human-friendly request – a domain name like todhost.com – and translates it into a computer-friendly server IP address – like 108.179.196.80

How DNS works

You can find both free DNS and premium DNS. All Todhost customers get access to premium DNS..

One big reason for choosing premium DNS is speed and reliability. Looking up DNS records and directing traffic takes time, even if it’s just a matter of milliseconds.

Typically, the free DNS that you’ll get from your domain name registrar is comparatively slow, whereas premium DNS often offers better performance. For example, in our tests, we found the free NameCheap DNS to be 33% slower than Amazon Route 53 premium DNS. Additionally, premium DNS can offer better security and availability, especially when you’re under a DDoS attack.

 

Your WordPress Theme Matters

Everybody loves a brand new WordPress theme, but be careful before you go out and grab the one with all the new shiny features. In regards to performance, every element you see in a theme has some impact on the overall speed of your website. And unfortunately, with thousands of themes out in the wild, there are both good ones and bad ones.
Your WordPress theme matters for performance. Choose the right one from the start.

So how are you supposed to know which one to choose? We recommend going with one of the following two options:

  1.     A fast lightweight WordPress theme that is built with only the features you need, nothing more.
  2.     A more feature-rich WordPress theme, but you can disable features that aren’t in use.

Things such as Google Fonts, Font Awesome icons, sliders, galleries, video and parallax scripts, etc. These are just a few of the many things that you should be able to turn off if you aren’t using them. You don’t want to be trying to tweak these manually after the fact. And we aren’t going to show you 50 different ways to strip things out. Instead, you should start or switch to a WordPress theme that is either lightweight from the beginning or gives you these options.

 

Manage Your WordPress Plugins

 

Now for the scoop on WordPress plugins. You might have been told that you shouldn’t install too many plugins or it would slow down your WordPress site. While this is sometimes true, it’s not the most critical factor. The number of plugins isn’t as important as the quality of the plugins.

Just like with themes, it matters how the plugin is developed and if it was built with performance in mind.

While it’s fun to add code to your site, this isn’t always practical for the following reasons:

  1.     You have to maintain the code yourself and keep it updated as standards change. People are busy, why not rely on the fantastic developers who know the standards better than most?
  2.     Most of the time, a well-coded plugin isn’t going to introduce much more overhead than the code itself.
  3.     You have to remember a majority of the WordPress community isn’t as tech savvy as the developer crowd. Plugins are solutions that help solve problems.

With that being said, there are of course not so great plugins out there which you want to stay away from.

However, it can’t be ignored that one of the things people love about WordPress is its massive library of third-party plugins. But with 56,000+ free plugins listed at WordPress.org alone and thousands more listed elsewhere, it can be hard to find the one plugin that you need.


One Big Issue with WordPress Plugins

One big issue with WordPress plugins is the uninstall process. Whenever you install a WordPress plugin or theme, it stores the data in the database. The problem is that when you delete a plugin using one of the standard methods, it typically leaves behind tables and rows in your database. Over time this can add up to a lot of data and even begin to slow your site down.

And besides the database, a lot of plugins also leave behind additional folders and files.This is commonly seen with security and caching plugins which create additional directories for logging. For example, after a Wordfence plugin is deleted, you are left with a “wflogs” folder in our wp-content directory. And the majority of plugins and themes on the market work this way.

 

Optimal WordPress Settings

Now to move on to optimal WordPress settings. Here are a couple of changes you can make to help speed up your WordPress site. Many of these are very subtle changes, but everything helps!

Change Your WordPress Login URL

By default your WordPress site’s login URL is domain.com/wp-admin/. One of the problems with this is that all of the bots, hackers, and scripts out there also know this. By changing the URL, you can make yourself less of a target, better protect yourself against brute force attacks, and decrease the bandwidth used by the bots that hit this URL repeatedly.

Changing your WordPress login URL can also help prevent common errors like “429 Too Many Requests.” This is not a fix all solution, it’s merely one little trick that can help protect you and decrease the load on that page.

To change your WordPress login URL we recommend using one of the following plugins:

    WPS Hide Login (free)
    Perfmatters (premium, but includes other performance optimization settings. Developed by a team member at Kinsta)

 

Disable or Tweak Plugin and Theme Updates

 

Slow WordPress admin dashboards can be impacted by the network, data center location, and even PHP versions. But another factor that not a lot of people talk about is the WordPress update checker that runs in the background. This is one instance where having a lot of WordPress plugins and themes could hurt you.

Essentially the problem is that the built-in WordPress update checker makes an external GET request behind the scenes. Sometimes this can be periodic or very frequently. If it’s happening all the time, this could bring your admin dashboard to a crawl.

This is more of a problem with how the update checker in WordPress is built. If you’re suffering from slow WordPress admin dashboard load times, you might want to give this a try. The remedy is to disable automatic updates. Warning: Only do this if you intend to check for updates manually. Many updates include security and bug fixes.

To disable updates, we recommend using one of the following plugins:

  1.     Disable All WordPress Updates: Completely free with no settings. Does what it says well.
  2.     Easy Updates Manager: Provides more control over selective updates. The core version is free.

You could easily set yourself a calendar reminder, disable the plugin once a week, check for updates, and then re-enable it.

 

Disable Pingbacks

A pingback is an automated comment that gets created when another blog links to you. There can also be self-pingbacks which are created when you link to an article within your own blog.

We recommend simply disabling these as they generate worthless queries and additional spam on your site. Remember, the less calls your WordPress site has to make the better, especially on high-traffic sites. Not to mention the fact that a pingback on your own website is just downright annoying. Follow the steps below to disable pingbacks.

Step 1 – Disable Pingbacks From Other Blogs

In your WordPress dashboard, click into “Settings → Discussion.” Under the Discussion Settings section uncheck the option “Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.”
Disable pingback in WordPress


Step 2 – Disable Self-Pingbacks

When it comes to disabling self-pingbacks you have a couple of options. You can use the free No Self Pings plugin. Or you can use a premium plugin like Perfmatters.

Alternatively, you could also disable self-pingbacks by adding the following code to your WordPress theme’s functions.php file. Warning, editing the source of a WordPress theme could break your site if not done correctly. Tip, you can easily add PHP snippets like this with the free Code Snippets plugin. This means you never have to touch your theme.

function wpsites_disable_self_pingbacks( &$links ) {
  foreach ( $links as $l => $link )
        if ( 0 === strpos( $link, get_option( 'home' ) ) )
            unset($links[$l]);
}

add_action( 'pre_ping', 'wpsites_disable_self_pingbacks' );

 

Limit Posts on Your Blog Feed

Whether your blog feed is set as your homepage or is another page of your site, you don’t need 50 thumbnails all loading at the same time. For those that run high-traffic blogs, your homepage is the most important page of your site, and you want this to load fast. The fewer requests and media the better in terms of performance.

Also, this is precisely why pagination was invented. Pagination is what you see at the end of blog feeds that allow you to browse to the next page. Typically these are numbers,or they might use “next/previous” posts. Your WordPress theme will most likely already have customized pagination built-in.

WordPress by default sets the limit on fresh WordPress installations to 10, but we’ve seen this changed so many times we’ve lost count. So make sure to double check what value you’re using. We recommend somewhere between 8 and 12.

You can find this option in your WordPress admin dashboard under “Settings → Reading.” You can then change the value for “Blog pages show at most.”

 

Implement Caching

Caching is by far one of the most important and easiest ways to speed up WordPress! But before we show you how to use caching, it’s essential first to understand how it works and the different kinds of caching available.

What is Caching?

Every webpage visited on your WordPress site requires a request to the server, processing by that server (including database queries), and then a final result sent from the server to the user’s browser. The result is your website, complete with all of the files and elements that make it look the way it does.

For instance, you might have a header, images, a menu, and a blog. Since the server has to process all of those requests, it takes some time for the complete webpage to be delivered to the user–especially with clunky or larger websites.

That’s where a WordPress caching plugin comes into play! Caching instructs the server to store some files to disk or RAM, depending on the configuration. Therefore, it can remember and duplicate the same content it’s been serving in the past. Basically, it reduces the amount of work required to generate a page view. As a result, your web pages load much faster, directly from cache.

Some other benefits of caching include:

  •     Your server uses fewer resources – This ties into speed, since the fewer resources make for a faster site. However, it also puts less of a strain on your server. This is very important when it comes to highly dynamic sites, such as membership sites, and determining what you can and cannot serve from cache.
  •     You’ll see lower TTFB – Caching is one of the easiest ways to lower your TTFB. In fact, in our tests caching typically reduces TTFB by up to 90%!

 

Types of Caching

When it comes to types of caching, there are two different approaches commonly used:

    Caching at the Server-Level
    Caching with a Plugin

1. Caching at the Server-Level

age cache is configured to work right out of the box with standard WordPress. You don’t have to do a thing! Simply launch your WordPress site and page caching will start happening.

We also have caching rules in place for ecommerce sites such as WooCommerce and Easy Digital Downloads. By default, certain pages that should never be cached, such as cart, my-account, and checkout, are excluded from caching.

That's all for now. Did you find this useful? Do let us now in the comments box below.

Share this post

Comments (0)

Leave a comment


Powered by Simple Blog