How to optimize WordPress for speed? Is it about having a better server, a faster theme, fewer plugins or something else altogether? Read down and learn more about WordPress optimization.

For ages, we all have been asking ourselves how to make our sites faster, especially since Google started considering speed as a metric for ranking. So, the question is how to do it? Is it about hosting in better servers? Or about running it as light as possible? Some people say you should quit using WordPress because it’s heavy and takes forever to load. (And these are people who code in NodeJS or any other JS based platforms). But that’s just impractical to normal users without a programming background. And trust me, I have made WordPress websites which are faster than some NodeJS websites. The sweet middle ground will always be WordPress. So, How do you start optimizing the biggest website/blogging platform in the world?1WordPress powers 30% of blogs in the universe. Source: WPBeginner
Optimization is something that you should start thinking about even before you start installing WordPress. I have tried my best to explain what could be done to make it super fast. This post will teach you what to keep in mind while you build a super optimized, super-fast website.

Before We Start, How To Measure Speed?

Of course, I’m talking about the tools. GTMetrix, Google Pagespeed Insights, etc… Although, don’t get carried away. These are not marks that you get on an exam. They are what they are, insights, guidelines. You don’t need to have a perfect score to have a perfectly optimized website. For example, Google Pagespeed will show lower scores for websites that are hosted far away from its measuring servers. It’s simple, longer the distance between the servers, slower the website. Nothing you can do about it. If you intend to serve the users in Europe, why care about a score for latency from a tool with a server located in the US? GTMetrix, on the other hand, provides testing locations for this propose. Treat these tools as a guideline. Not a conclusive metric of your websites speed.

TTFB… Ughh… TTTF… TTFB?

Most of you might have heard about the term Time To First Byte or TTFB. It’s the time which is required to receive the first byte of data from the server. Although, keeping a small TTFB is very tricky. It depends on a few things and this is how to optimize each of them.

  • The delay to process the PHP code by the server
  • The distance between the user and the host server
  • Speed of the connection between user and host server

The delay due to server is something that we have the most control over unlike the other two. Here is where the server comes in. We at KloudBoy2 KloudBoy is a high-performance WordPress hosting service, configured to the client’s needs, on-demand. normally go for Google Cloud, AWS EC2, Digital Ocean or Hetzner. While Google Cloud is not a proper host, its the fastest and costlier. It’s not just about which server to use. Mostly, it’s about how you configure a VPS. Here is the basic rule of thumb. Do not use if you don’t need it. PhpMyAdmin?3ProTip: What if you need to edit the database? Use Adminer a light weight single file PHP script to make simple changes. Not required. cPanel? Nope!

Use the stable latest of PHP, right now, 7.3 on an Nginx server and MariaDB. Need to install everything for perfect speed without getting your hands dirty? – Use Bajpan Gosh’s bash script for high-performance WP on Digital Ocean droplet.

Theme & Plugins

The aim is to create the fastest WordPress website. Use the lightest theme you can find. Lightest in terms of size (not the size of the theme, the size of the HTML page it renders), and requests. The number of requests needs to be under 50, preferably. What I have noticed is that since 2019, the web design philosophy has changed quite a bit towards optimization. There aren’t many breathtaking animations anymore (wow.js, is your worst enemy when it comes to speed), a single banner with call to action instead of sliders etc has given us a significant improvement when it comes to optimizing the website for speed.
Use essential plugins only, Akismet Anti-Spam is a yes, Contact Form 7 is a yes, gallery plugins – please don’t! If you want to use a page builder go for the lightest one. Even though Visual Composer is the most widespread WordPress page builder out there, it kinda shits the bed when it comes to speed. I have seen a little known(yet good) Oxygen Builder be faster than most, followed by Siteorigin builder, Elementor & Beaver builder. Hopefully, Gutenberg will catch up soon and knock everything off the table.
Also, I think its only fair to mention the security, SEO & backup plugins that developers use. I once got hands on a client’s WordPress site. It had all the possible junk security and backup plugins that you can think of. Looks like the developer had some bad experiences with Malware. Either way, TTFB of the site was over 30s! I know right! That’s like the entire time since the big bang!4Universe is 13,800,000,000 years old.(13.8 Billion). You learn something new everyday! The plugins I have seen the most are Wordfence, Yoast SEO, Redirection, Schema.org, Updraft, BackupBuddy. The worst thing about these plugins, have you seen the kinda messy files they create in the WP directory? I like keeping things clean. Fewer the mess, Fewer the issues, the greater chance of fixing something if its wrong.
I’m gonna tell you a few pointers that took me years to master;

  • If you keep your plugins and files to a minimum, you have a lower risk of getting infected with malware or any other issues.
  • If you are running on shared hosting, there is no security, only the illusion of one. One day or another, another WP website running on the same server is going to get infected. Even you think that you have a separate space, you don’t. Eventually, the same thing is going to affect you. No matter how much you clean up, it keeps coming back. I have seen it numerous times. It’s not worth it. STOP USING SHARED HOSTING!
  • Cloudflare Security is your best friend. No matter what plugin you use (ahem.. Wordfence) I have seen malware running around doing its thing without detection.
  • Stop backing up your files to the same server. That’s plain stupid.

Now lets see what to do to when it comes to each case;

  • Security
    If you are running on a VPS, and with minimal components, the chances of an attack are pretty low. The number of bugs on the server is low. Less code, fewer bugs, fewer attacks and faster website.
    Don’t use any security plugins. WordPress is quite secure. If anyone says the opposite, they have no idea what they are talking about, maybe some crappy developer used a malware pre-installed nulled theme and got him into trouble. Its the code that you put over WordPress that isn’t secure. If you are running on minimal plugins, you are 99% secure.
    When it comes to other attacks, like DDoS, brute force etc… Cloudflare got you covered. And you don’t even have to pay a penny.
  • BackUp
    Stop using stupid plugins that back up directly to the folder under wp-content or even backups to Google Drive or any other offsite of your choosing. I use ManageWP by GoDaddy. They are amazing, the monthly backups are free and not that costly when it comes to weekly or daily backups. They also got an option to backup every hour. Their migration service only costs $1! And all of this is a single click away. You can monitor(SEO, Performance and security) and update themes/plugins/core directly from ManageWP dashboard. Now, ManageWP is not foolproof. I have seen it go out of the binding from the website multiple times.5Pro Tip: Connect the site to ManageWP with the connection key, not the WP credentials.
  • SEO
    Stop using YOAST SEO. It used to be the greatest WP SEO plugin. Not anymore. I have been using RankMath since the beta version came out before it was rolled out to the WP platform. RankMath is entirely free, even the premium features that you can find in YOAST and more. For example, you no longer have to install a schema.org plugin or a redirection plugin or a 404 monitor anymore. All this exists in RankMath. All this, and its 40% lighter than Yoast. RankMath also releases cutting edge tech when it comes to SEO, for example, auto pinging Google when changes are made to the sitemap. You can read more about the comparison between these plugins.

Media

There is nothing that I have to tell you about the media that you already do not know. Lower the size of the media file, better your website speed. Although, reduce the size before you upload your files, try not to use image optimization plugins like WP Smush or EWWW Image Optimizer.

You do that on your machine before you upload, I normally use Photoshops’s Save for web, and later running it thorough kraken.io or squoosh.app6Squoosh is an app built by Google Chrome Labs in 2018 aiming at higher page speeds by better image compression. for a lossless or lossy compression, depending on the situation. Now, these are the things that everyone does. If you need to have an edge on image optimization, use a CDN for image delivery coupled with Lazy Load. I prefer using Gumlet.7Gumlet is a free CDN for images, that can be used for any website. They have an option to add WordPress media files. Gumlet has a WordPress plugin, although it’s not necessary to use it for the service to work. You can add it on the optimizing plugin that you use. Gumlet automatically converts the files into WebP, so your website will be using next-generation image format for web.

WordPress Optimization Done Right - Jyothis Joy
Gumlet CDN configured in WP Rocket

Cache Plugins For WordPress Optimization.

This is the part where we will dig deeper into using performance optimization plugins. I would like to introduce 3 plugins into the mix here. – WP Rocket (Premium), W3 Total Cache(Free) & Autoptimize(Free). Almost all the settings and configurations in these plugins overlap, the only difference is that Autoptimize is light and very little configurations, followed by WP Rocket when it comes to complexity. W3 Total Cache has so many settings, that you might end up having a headache and broken website (unless you stick to the basic settings).

In this, I’ll be explaining in detail about these configurations in respect to WP Rocket, but will add details on some of the settings available in W3 Total as well. Following are the settings you need to configure.

  • Page Cache
  • Minifing & Combining
  • Browser Cache
  • CDN
  • Pre-loading

Let’s dive deeper, although, I will not be explaining what each of them is; just the configurations.

  • Caching
    Page Cache needs to be ON, Update interval of the cache depends on the kind of website you are running. If it is a corporate website, you can keep the cache without an update as long. I would say once a few days is optimal. If its a blog with frequent updates, keep the caching interval low. A few hours is good.
    Browser Cache is a must. It retains the files in the users’ computer so that it can be used again when they revisit. Hence, the user won’t have to download those files stored on their computer.
  • Pre-loading
    Pre-loading is self-explanatory, the website’s cache being pre-loaded, so that it would be served faster when a user requests it. You can actiavte Sitemap based Preloading in WP Rocket.
    DNS pre-loading also can be used if you have files being requested from another domain. 
  • Minification & Combining
    Minify HTML, CSS, JS. These files can be later delivered from Cloudflare CDN. You not only shave some size, but you can also reduce the number of files drastically. 
    But do test it, if you break something, figure out what’s breaking it and disable the configuration. It’s alright though, Cloudflare already caches everything and it won’t make a huge difference.

CloudFlare

Cloudflare is your best friend when it comes to optimizing your WordPress website. In this section, I will be explaining what rules you need to use to make the website lightning fast.

WordPress Optimization Done Right - Jyothis Joy

You need to create two rules. One is to enable caching in the domain, the another to bypass that cache for /wp-admin/ pages.

  • Rules for *.example.com/wp-admin/* with priority 1.
    Security Level: High or I'm under attack.
    Cache Level: Bypass

  • Rules for *.example.com/*with priority 2.
    Browser Cache TTL: _ Days
    Always Online: Yes
    Cache Everything: Cache Everything
    Edge Cache TTL: 4 days

Conclusion

This is how you configure your WordPress website to have a very small size, latency and very high speed. Do comment if you have any questions! Subscribe for more in-depth information.

Comments to: WordPress Optimization Done Right.

    Your email address will not be published. Required fields are marked *