=Dit artikel is momenteel alleen beschikbaar in het engels=
If you like using plugins as much as I do, your (multisite) website can get slow very fast. I’d like to share with you a couple of ways to increase WordPress’ loading speed. (At the time this article was written we were still using shared hosting, nowadays were on a VPS which basically means that we get AAA ratings without the use of plugins) The overall configurations mentioned in this article could use some fine-tuning depending on the plugins you’re using AND the direct user experience, after all these are just colored letters.
Why is my site slow?
The most common influences on loading speed:
-
Hosting
Easy fix:
Shared (cheap) hosting: limited custom server configuration possible and you will share the server with 20-50 others which means that if there’s more visits on those websites yours will get slower as well.
VPS or Private server: fast, faster, fastest! Custom configurations, almost no need for optimizationPlugins: WP-DBManager, Optimize Database after Deleting Revisions
-
Server/.htaccess
Easy fix:
To make use of Gzip compression, Deflate, Expires Header etc etc these should be activated on your server and often in your .htaccess or nginx.conf as well. Look closely at GTmetrix/ Webpagetest test results and talk to your provider. Start by pasting this code to your .htacess file A general fix-it-all .htaccess code snippet -
Coding
Easy fix:
Plugins and themes (and WordPress itself!) are created by many, many people: research and choose your plugins and themes well to keep all coding top notch. It often pays to pay for premium plugins and themes (and consequently support WordPress). Check out the Genesis Framework and WPMU DEV, that’s all I have to say. -
Database
Easy fix:
Databases can get cluttered: clean regularly by removing all data and tables that are not used and by optimizing the codePlugins: WP-DBManager, Optimize Database after Deleting Revisions
-
Plugins
Easy fix:
We all love them but the more you activate the more weight they will put on loading time, so choose wisely! It pays off to keep an eye out for better options. Also by using plugin Organizer you are able to stop plugins from loading on pages where they are not used AND decide the order they load in! (tip: load plugins that use a lot of jquery last) -
Content
Easy fix:
Optimize your content optimized (serve same content but smaller in size: minified, gzip compressed etc.) and caching (serve content that has been stored grouped). Images are especially heavy to load: reduce the size of your images by compressing. Consider using a CDN to load your content from a faster server.Plugins: Better WordPress Minify, Hyper Cache, WP Smush or WP SMUSH PRO, BJ Lazy Load, Use Google Libraries, Wordfence Pro (because of excellent Falcon Cache addition!), WP Super Cache, W3 Total Cache, any CDN: we have happily used the free version of Incapsula for a long time
Before we begin: to speed up wordpress the WP Super Cache (my personal favorite) and W3 Total Cache are excellent and extensive plugins for caching and from what I read the latter is now multisite compatible as well. They both have a bit of a learning curve if you don’t want to blindly activate functions and hope for the best. Once installed and configured you can add numbers 1, 2, 3 and 4 of this article to further optimize your set up. From this point on this article will focus on optimizing without the use of these plugins.
Speed up WordPress in 9 steps
To keep this article manageable we will not go into specific details on how these plugins work, just global information and configuration, plugins used:
- Optimize Database after Deleting Revisions
- A general fix-it-all .htaccess code snippet
- Better WordPress Minify
- BJ Lazy Load
- Plugin Organizer
- Use Google Libraries.
- Hyper Cache
- WP Smush.it
- Incapsula CDN, free version
NB. This article is an updated version of the original from 2013 and to keep the used plugins lined up with the test results I have not changed them or added new ones. The following plugins we have grown to love since:
- Minit – ‘Plugin to combine CSS and Javascript files’
- Minqueque – ‘Minify & Concatenate Enqueued Scripts & Styles’
NOTE: easy plugin with great speed optimization gains but unfortunately not very SEO friendly: prevents Google to access parts of content - Wordfence Security – ‘Protecting your website from hacks and malware’
NOTE: one of our favorites and because of the Falcon cache option (Pro only) not just for air tight security!
7 Golden Tips on Speed Optimization
These will save you at least 2 weeks of frustration:
- Backup your database and files
- Turn cache off when your testing or editing anything (but the cache itself) or you’ll be served ‘old’ content
- Remember that browser cache can also serve ‘old’ content –> refresh or clear browser cache
- Cache plugins often leave /cache/ folders in FTP, remove these before testing other cache plugins
- Cache plugins can leave code in wp-config and .htaccess, remove these before testing other cache plugins
- Don’t forget to test if your contact form/payment options etc. still work with your cache solution
- Backup your database and files
Step 0- Back up your website!
One of my favorite plugins all time is the WP-DBManager plugin to backup, optimize and repair your database. Copy FTP if you are able and/or make database and files backups from your hosting environment. There is no such thing as too many backups folks!
Step 1 – Deleting revisions
Old posts and pages (and a post/page is ‘old’ after a single change) are stored on your database and will slow down your website, especially that much valued First Byte Time. The Optimize Database after Deleting Revisions is a great plugin, very easy to work, which allows you to remove this extra baggage: you will be surprised at the difference in performance after using it!
Step 2 – A general fix-it-all .htaccess code snippet
Sets Expires Headers, activated gzip compression and deflate (if active on server), sets etags, etc. etc. Just copy/paste it in your .htaccess file get it here. In almost all cases a gigantic win!
Step 3 – Install the Better WordPress Minify plugin
There a several good minify plugins around, I prefer the Better WordPress Minify because of performance and compatibility with other plugins.
Step 4 – Install the BJ Lazy Load plugin
The BJ Lazy Load plugin is one of my favs, it allows you to choose which element of your content under the fold will be loaded immediately or on scroll. This will load the initial view much quicker and will save bandwidth at the same time. Last but not least: option to have images ‘fade in’ on load: SMOOTH!
Step 5 – Download Plugin Organizer
Another one of my preferred plugins to speed up WordPress is Plugin Organizer by Jeff Sterup. It has quite a few nifty tricks but the ‘selective Plugin Loading’ and the ‘Plugin Load Order’ options I like best. Basically it means that you can now tell WordPress not to load plugins that are not used on a specific post or page if it not used there (!), which will reduce HTTP requests and thus loading time. This option is also a great tool to bypass conflicting plugins and still use them on your website. The ability to change the loading order will allow you to tweak your performance even further, for example by loading plugins that rely heavily on jquery which cause a webpage to load partly, then pause, and then load the rest of the page. Personally I really dislike having to wait for it to display until the rest of the page is loaded, it is messy and suggests that the website is slow in general. Now you can find the best position for it to load and time-push a plugin that is active under the fold or jquery rich to load later. Seriously, how cool is that?
Step 6 – Use Google Librairies
Just drop Use Google Libraries in the mu-plugins folder and you’re able to ‘use the content distribution network side of Google’s AJAX Library API, rather than serving these files from your WordPress install directly.’ TIP: check regularly (or subscribe to RSS or Twitter feed) to keep this file updated, it happened to me that an outdated version started all sorts of havoc.
Step 7 – Hyper Cache
It turned out to be nearly impossible to find a compatible cache plugin for my networks, imagine my relief when I stumbled into the Hyper Cache plugin by Stefano Lissa! It performs very well (just make sure you make the required adjustments mentioned on the website) and also reduces your bandwidth a lot. I mean what, 90% or so? Yep. NB. I would not recommend to use this plugin on networks where anyone can register, since this plugin needs to be deactivated before every update.
Step 8 – WP Smush it
Compress your images (without loss of quality) using WP Smush.it on upload or manually, the Pro version rocks even harder!
Step 9 – Incapsula (free) CDN service
I have tried to hook up with several free CDN services and before Incapsula I never got it working. Either it was too complicated, or a credit card number was required (I refuse), or it just didn’t work at all. I’m glad that I kept trying though, this CDN service really brings the speed of the website to excellent levels. Incapsula has a beautiful website and signing up is easy, plus and the support is great even for free accounts. They will improve performance, save you a great deal of bandwidth, and add security. You’ll have to make an account, sign up a website and make the required DNS changes. Incapsula will send an email when this is done correctly, easypeasy. (Note that after you have made some changes in your DNS settings you have to give it a couple of days before you test your website!) Caching will improve over the next weeks.
I hope you have enjoyed this article and that it was of use to you, if you have any questions, additions or remarks please do not hesitate to leave me a comment below. Sharing this article is appreciated!
Johan Horak says
Hi Thanks for this. I will now also try Incapsula. I tried Google Libraries but it did not work with Jetpack galleries.
says
Hi Johan thanks for your reply, have you tried putting the use-google-libraries.php file in mu-plugins?
Mark says
Hello,
Thank you for the article. Have you tried using WP Super Cache?
I’m also trying to figure out a nice cache and speedup system for a multisite but can’t get a hang of it.
says
Hi Mark I haven’t used Wp super cache with shared hosting but recently had great experience using it on VPS, on a multi network installation even. I think it would be save to assume that it will work very well on a single multisite. Found it very easy to install and configure (used the directions given on WordPress.org), but because the plugin needs to be network activated there was no way to disale it on a single website which got confusing (changes would be delayed because of caching) when I did some work. Good luck!
Mark says
Thank you for the answer.
I have installed it but haven’t noted a noticeable speed increase. I might just be that I’ve build a badly optimized website.
I’ll keep trying.
Have a good day
says
Just in case: make sure you do testing via 3rd party like webpagetest or log out to check caching, OR make sure to uncheck the ‘cache only for logged out users’ box.
On a less obvious note: always make sure you have deleted all folders of the previous caching plugin! Use FTP to check the wp-content and uploads folder. Just recently I made the mistake not to check this and it really messed with my head!
Bart says
Een heel goed artikel, Jaan. Blij om te constateren dat ik met uitzondering van Smush it en de Hyper Cache plugin, al deze plugins al gebruik. Voor het cachen gebruikte ik de W3Total cache plugin, maar de Quick Cache plugin is veel gebruiksvriendelijker en werkt zeker even goed…
says
Hoi Bart bedankt voor je reactie, ik heb ook veel goede dingen gehoord over Quick cache maar denk dat één van mijn standaard netwerk geactiveerde plugins een conflict veroorzaakte want heb hem nooit goed kunnen laten werken. Wat betreft Wp smushit ben ik wat hard geweest inmiddels werk hij naar behoren en kan ik er zonder ergernissen van gebruik maken!
James Endersby says
Just want to say thanks for your recommendations to speeding up a WP Multisite. I had a client site that was incredibly slow. Once I set up, with a CDN and now the site is now super fast.
says
Hi James I’m happy to hear that! I see you’re from Brighton? Next year I’m moving there! It’s good to know I’ve already made contact with a fellow ‘Pressie!
Robert says
Hey Nick,
op de pagina van hyper cache raden ze lite cache aan, ervaring hiermee?
Tevens, kunnen al deze plugins geinstalleerd worden en werken ze dan automatisch met alle multisites (ook bij het gebruik van domain mapping?) ivm CDN etc (ik gebruikt CDN77)
Heb je tevens nog handige tips ivm roundrobin and backups voor multisites?
Bedankt voor het article :)
says
Hoi Robert, bedankt voor je reactie. Ik heb geen ervaring met Lite Cache maar als Stefano Lissa dit aanraadt zou ik er zeker vanuit gaan dat het de moeite waard is. Ik heb wel uitgebreide ervaring met Hyper Cache die je per site moet activeren, en is dus niet voor elke site automatisch geactiveerd. Nadeel is dat met elke update deze plugin eerst gedectiveerd moet worden en is dus minder geschikt voor websites met leden.
De andere plugins in dit artikel kunnen -bij mijn weten- allemaal netwerk geactiveerd worden waarna de meeste hiervan per site ingesteld moeten worden. Het is echter ‘good practise’ om een plugin waar mogelijk per site te activeren zodat alleen Google Libraries (mu-plugins) en Wp Smush.it (uitzondering op de regel omdat die werkelijk op ELKE website toegevoegde waarde heeft) overblijven. Dit heeft geen invloed op je domain mapping.
Ik heb helaas geen ervaring met Round Robin i.v.m. backups.. Succes!
Fabrício says
you got to use cloudflare before Incapsula? if so, the results were very different?
Chris says
I am a wp mu developer also but am currently running under shared hosting on hostgator and it’s a DOG to be honest. Page speed tests worldwide are good although not brilliant.
I too am thinking of moving to a VPS but am wondering if you have any recommendations on that?
Thanks for your article… bookmarked for later reading in case I don’t move to a vps.
Cheers
Chris
says
Hi Chris thanks for your reply. Yeah a post about VPS hosting has been in the making for a while now! I’ll give you the short version:
I have been with the same hosting company since the start of my WordPress journey and was lucky to have picked an excellent one: Yourhosting. This dutch company is not the cheapest but I wouldn’t call it expensive either. Thing is they have an amazing helpdesk which really took care of me in times when I didn’t even know what a hex color was. I mean: there are some relentless bastards over there going above and beyond to help a customer out, and believe me I really pushed the envellope :-)
When it was time for me to grow and switch to VPS I really did some investigating and found some great options (seelater in this post) but eventually I stayed with these guys, because of trust and also out of loyalty. They have not let me down! VPS is fast (so fast it’s not even tweakable, all effort (plugins) just ends up slowing it down!) and the service is still marvelous.
Downsides: no Cpanel (although the native panel is great), not the cheapest
In my search for VPS hosting I eventually stayed with Yourhosting but it was a very close call with Aecnu WPMU hosting, which provides affordable VPS hosting using servers specificly tweaked to WordPress! I have had extensive email contact with the owner Joe Anderson who (besides being a stand up guy) really knows his business. Although I have not had direct experience I would not hesitate to vouch for this company. I will probably be doing business with Aecnu at some time in the future.
Last but not least: I love WPMU DEV. Besides all of their plugins, themes and professional help they also have excellent articles on everything WordPress, and that includes an in-depth investigation on hosting. See link below.
Chris, I love to hear how VPS will work out for you! Greetings, Nick
Yourhosting (aff) link
Aecnu WPMU hosting
WPMU DEV article