Speed is the ultimate frontier of the web nowadays. Everybody wants it, especially since Google counts page speed as a big factor in search rankings.
So yes we need it. But there is only so much a theme (and us as theme developers) can do in terms of speed optimizations. Sure, we can be careful not to do silly things like a bunch load of MySQL queries, load the right image sizes, reduce the number of requests for static resources, etc. But these are only the tip of the iceberg.
The huge gains in terms of site speed are achieved outside the theme. So let’s get rolling with some tips for you.
Caching is king
When it comes to WordPress, a CMS that generates dynamic pages, the first and the most important thing we can do is remove the dynamic from the equation. It is a well-known fact that static pages are served by the webserver much, much faster (because it removes processor and MySQL speed from the equation).
In WordPress, this can be achieved with caching plugins that will generate temporary static HTML files for your pages/posts, while managing their refresh on content updates.
The most used caching plugins are W3 Total Cache, WP Super Cache, and the king of all, WP Rocket. All are really good and will work just fine. They still need some configuration work but nothing that an average WordPress user can’t manage.
The most important section in these plugins is the Page Cache, as this is the one that generates those static HTML files. We recommend you not to use their JS and CSS minification since it most likely will break things if not properly configured. They also offer database and object caching; we leave this to you to decide, but it won’t make much of a difference.
Image optimization is a must
Nowadays sites tend to be full of images, much more so than a couple of years ago. The web has become much more visual. This raises the concern that those images might not be that well optimized, resulting in huge page sizes (1,2,3, and even more MB).
So we need to make sure that our image file size is at its lowest without losing the quality.
Thankfully there are a couple of WordPress plugins out there that focus on just this problem. They either use scripts installed on your server (like pngcrush, advpng, jpegcrush, etc – you will need to talk to your host about these) or online services that do the crunching for you.
We recommend these plugins:
You should also be aware that when switching themes, you most likely need to regenerate your thumbnails (that are autogenerated on image upload) so you will allow the new theme to use the best image sizes it was intended to. For this, we recommend Regenerate Thumbnails.
A good host is worth a 1000 optimizations
There’s simply no way around this. You can’t expect to pay for a VW and get a Ferrari. If speed is a major concern to you then on top of your list must be getting proper hosting.
When talking about hosting services, there are 2 cases: you can either go with a shared hosting or a dedicated one. We highly recommend you read this in-depth analysis of the 9 best options for managed WordPress Hosting Compared.
Shared hosting is generally cheap because it allows the hoster to cram into the same physical server a large number of clients. When this happens, you must be aware that your site is in a constant battle with many other sites for resources, mainly CPU and HDD speed. So you are pretty much in the hands of destiny in terms of speed. If you are lucky to not be sharing servers with some resource-hungry websites, you might be good, but you never know. This doesn’t mean that there aren’t shared hosting offerings out there that offer premium speed (for the right price) taking the burden of managing your own server out of your hands. You just have to be careful and know that you get what you pay for.
The second option when it comes to hosting your precious site is the dedicated server (either a VPS or a true dedicated server). If we are talking about cloud-based servers (VPS) the costs are not that big but the benefits are huge when compared to shared hosting services. The dedicated servers are generally expensive and are aimed at pros, so we won’t discuss them here. If you are not that tech-savvy you may need a managed VPS that will add additional costs, but it is well worth it.
Let me give you some advantages of having your own VPS, in no specific order:
- guaranteed CPU access;
- high-speed HDDs;
- lower response times (that damn time to the first byte);
- you can activate server-side gzip compression that will greatly reduce the size of your static resources (CSS, JS, and image files);
- you can remove the cookies on static resources – cookie-less domain (you will see this popping up in Page Speed);
- you can quit using the Apache web server and go with a much speedier Nginx web server;
- you can use server-side caching (much faster than file-based one);
- you can configure MySQL to your own website necessities hence more speed;
- you can have load balancers, but we are getting too technical here 🙂
As you can see most of the things that are required to get that high Google Page Speed score are out of the theme’s hands. They need server-side configuration and tools.
I hope this brief introduction to the intricacies of optimizing your site has enlightened you somewhat on the steps you need to take to increase your speed so your visitors and Google like you more.