Speeding Up Your WordPress Site

Speed is the ulti­mate fron­tier of the web nowa­days. Every­body wants it, espe­cial­ly since Google announced that page speed is a big fac­tor in search rank­ings. More recent­ly even mobile site speed is a big fac­tor.

So yes we need it. But there is only so much a theme (and us as theme devel­op­ers) can do in terms of speed opti­miza­tions. Sure we can be care­ful not to do sil­ly things like a bunch load of MySQL queries, load the right image sizes, reduce the num­ber of requests for sta­t­ic resources, etc. But these are only the tip of the ice­berg in terms of site speed.

The huge gains in terms of site speed are achieved out­side the theme. So let’s get rolling with some tips for you.

Caching is King

When it comes to Word­Press, that is a CMS that gen­er­ates dynam­ic pages, the first and the most impor­tant thing we can do is remove the dynam­ic from the equa­tion. It is a well known fact that sta­t­ic pages are served by the web­serv­er much much faster (because it removes proces­sor and MySQL speed from the equa­tion).

In Word­Press, this can be achieved with caching plu­g­ins that will gen­er­ate tem­po­rary sta­t­ic HTML files for your pages/posts, while man­ag­ing their refresh on con­tent update.

The most used caching plu­g­ins are W3 Total Cache and WP Super Cache. We tend to lean towards W3 Total Cache because it offers more speed, although being some­what more com­pli­cat­ed. But both are real­ly good and will work just fine. They still need some con­fig­u­ra­tion work but noth­ing that an aver­age Word­Press user can’t man­age.

The most impor­tant sec­tion in these plu­g­ins is the Page Cache, this one being the one that gen­er­ates those sta­t­ic HTML files. We rec­om­mend you not to use their JS and CSS mini­fi­ca­tion since it most like­ly will break things if not prop­er­ly con­fig­ured. They also offer data­base and object caching; we leave this to you to decide, but it won’t make much of a dif­fer­ence.

Image Optimization

Nowa­days sites tend to be full of images, much more so then a cou­ple of years ago. The web has become much more visu­al. This rais­es the con­cern that those images might not be that well opti­mized, result­ing in huge page sizes (1,2,3 and evem more MB).

So we need to make sure that our image file size is at it’s low­est with­out loos­ing qual­i­ty of course. Thank­ful­ly there are a cou­ple of Word­Press plu­g­ins out there that focus on just this prob­lem. They either use scripts installed on your serv­er (like pngcrush, advp­ng, jpegcrush, etc — you will need to talk to your host about these) or online ser­vices that do the crunch­ing for you.

We rec­om­mend these plu­g­ins:

Also you should be aware that when switch­ing themes, you most like­ly need to regen­er­ate your thumb­nails (that are auto­gen­er­at­ed on image upload) so you will allow the new theme to use the best image sizes it was intend­ed to. For this we rec­om­mend these plu­g­ins: Force Regen­er­ate Thumb­nails and AJAX Thumb­nail Rebuild.

A good host is worth a 1000 optimizations

There’s sim­ply no way around this. You sim­ply can’t expect to pay for a VW and get a Fer­rari. If speed is a major con­cern to you then on top of your list must be get­ting a prop­er host­ing.

When talk­ing of host­ing ser­vices, there are 2 cas­es: you can either go with a shared host­ing or a ded­i­cat­ed one. We high­ly rec­om­mend you to read this in-depth analy­sis about the 9 best options for man­aged Word­Press Host­ing Com­pared.

Shared host­ing is gen­er­al­ly cheap because it allows the hoster to cram into the same phys­i­cal serv­er a large num­ber of clients. When this hap­pens you must be aware that your site is in a con­stant bat­tle with many oth­er sites for resources, main­ly CPU and HDD speed. So you are pret­ty much in the hands of des­tiny in terms of speed. If you are lucky to not be shar­ing servers with some resource hun­gry web­sites, you might be good, but you nev­er know. This doesn’t mean that there aren’t shared host­ing offer­ings out there that offer pre­mi­um speed (for the right price) tak­ing the bur­den of man­ag­ing your own serv­er out of your hands. You just have to be care­ful and know that you get what you pay for.

The sec­ond option when it comes to host­ing your pre­cious site is the ded­i­cat­ed serv­er (either a VPS or a true ded­i­cat­ed serv­er). If we are talk­ing about cloud based servers (VPS) the costs are not that big but the ben­e­fits are huge when com­pared to shared host­ing ser­vices. The ded­i­cat­ed servers are gen­er­al­ly expen­sive and are aimed at pros, so we won’t dis­cuss them here. If you are not that tech savvy you may need a man­aged VPS that will add addi­tion­al costs, but it is well worth it.

Let me give you some advan­tages of hav­ing your own VPS, in no spe­cif­ic order:

  • guar­an­teed CPU access;
  • high speed HDDs;
  • low­er response times (that damn time to first byte);
  • you can acti­vate serv­er side gzip com­pres­sion that will great­ly reduce the size of your sta­t­ic resources (CSS, JS and image files);
  • you can remove the cook­ies on sta­t­ic resources — cook­ie-less domain (you will see this pop­ping up in Page Speed);
  • you can quit using the Apache web serv­er and go with a much speed­i­er Nginx web serv­er;
  • you can use serv­er-side caching (much faster than file based one);
  • you can con­fig­ure MySQL to your own web­site neces­si­ties hence more speed;
  • you can have load bal­ancers, but we are get­ting to tech­ni­cal 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 serv­er-side con­fig­u­ra­tion and tools.

I hope this brief intro­duc­tion into the intri­ca­cies of opti­miz­ing your site has enlight­en you some­what on the steps you need to take to increase you speed so your vis­i­tors and Google like you more.

Still struggle?

Write us down an e-mail at hello@pixelgrade.com, and we will glad­ly assist you dur­ing this process.

Updated on May 21, 2018

Was this article helpful?