Looking for some awesome WordPress speed tips?
These are the same tips I use to get 100% GTmetrix scores on my homepage and <2s load times on nearly every one of my posts. You’ll learn everything from optimizing plugins, images, server response times, CDNs, and external resources like Google Fonts and YouTube videos.
Use GTmetrix as your tool of choice.
It gives accurate load times and has extensive recommendations like which images need to be optimized, which plugins are slowing down your WordPress site, time to first byte, CDNs, etc.
Google PageSpeed Insights is only good for measuring server response times which should be <200ms. Otherwise, it’s pretty useless and there are many articles out there explaining why.
Pingdom is the most accurate tool for measuring load times, but their recommendations aren’t as great as GTmetrix. (for example, it doesn’t say which specific images need to be optimized).
This post you’re reading has a 1.61MB page size, 69 requests, and still loads in about 1s:
If you have questions or need help, drop me a comment or you can also hire my WordPress speed optimizer to help you improve scores + load times with before + after GTmetrix reports.
1. Avoid Known High CPU Plugins
“It’s not the number of plugins, it’s the quality,” said everyone
If you’re using any of these slow plugins, consider replacing them with a faster alternative.
How To Find Your Slowest Plugins
You can either use Query Monitor, or go through your GTmetrix report to see if the same plugin is showing multiple times in your PageSpeed and YSlow tabs. Also check the Waterfall:
2. Don’t Let Plugins Run On Every Page
Asset CleanUp lets you selectively disable plugins + scripts from loading on certain content. For example, you can disable your contact form and rich snippets plugin from loading on content they don’t show on. Or disable your affiliate marketing plugin from loading on pages.
This eliminates unnecessary requests and reduces load times. Asset CleanUp is also easier to use than Plugin Organizer and other plugins with similar functionality. I highly recommend it.
3. Use A Top Rated Cache Plugin
Which cache plugin is best? Look at these Facebook polls:
WP Rocket is usually #1 because it comes with many features most cache plugins don’t (database cleanup, lazy loading images + videos, local fonts + analytics, prefetching, CDN integration) which is why it usually yields better scores + load times than other cache plugins.
That also means if you were to use most other cache plugins, you would need to install about 6 extra plugins, when WP Rocket has these all built-in. If you’re like me, you’d have just 1 plugin.
WP Rocket Features Not Included With Most Cache Plugins:
- Database Cleanup: built-in to WP Rocket, or use WP-Optimize.
- Lazy Loading: built-in to WP Rocket, or use WP YouTube Lyte.
- Heartbeat Control: built-in to WP Rocket, or use Heartbeat Control.
- Local Google Analytics: built-in to WP Rocket, or use CAOS Analytics.
- Local Google Fonts: built-in to WP Rocket, or use either OMGF or SHGF.
- Prefetch DNS Requests: built-in to WP Rocket, or use Pre* Party Resource Hints.
- Facebook Pixel Browser Caching: built-in to WP Rocket (no other plugin does this).
- CDNs: built-in to WP Rocket (both Cloudflare + multiple CDNs), or use CDN Enabler.
Swift Performance Lite is good too, but it’s more difficult to setup and you probably won’t get the same results as WP Rocket. But Swift does come with a plugin organizer which is helpful.
4. Upgrade To PHP 7.3
Upgrading to a higher PHP version is the easiest thing and can make your site 2-3x faster.
All you have to do is login to your hosting account, find the PHP version manager, and make sure you’re on the latest version (check your website after). Some hosts are quicker to release newer PHP versions than others, another reason why you should avoid GoDaddy, Bluehost, and HostGator (both were late to release PHP 7.2 and will likely be stuck there for awhile).
You can use the Display PHP Version plugin to check which PHP version you’re currently on.
5. Optimize External Scripts
External scripts can are anything on your website that create external requests from outsides websites. Embeds are very common (embedded videos, Github code, job postings, even GIFs).
Some scripts can be optimized (hosting fonts + analytics tracking code locally), lazy loading videos, or even clever ways like taking screenshots of Twitter posts instead of embedding them. You can even try caching Gravatars using a plugin or using Disqus conditional load or Perfmatters (created by Kinsta) to optimize WooCommerce scripts, styles, and cart fragments.
Other external scripts are nearly impossible to optimize. I have never seen a site with AdSense have a decent GTmetrix report. High CPU social sharing and commenting plugins will always slow down your site (this ties into choosing lightweight plugins). My suggestion – optimize the ones you can, try to avoid the rest, and whatever’s leftover, make sure you prefetch this list of common domains to prefetch using WP Rocket. But, avoid external scripts whenever you can.
You can host fonts locally using WP Rocket, OMGF, or Self-Hosted Google Fonts. Asset Manager and Autoptimize also have options for this. But the best way to optimize fonts is to host fonts locally. Go to the Google Fonts website and download all fonts you’re using (be as minimal as you can with fonts and weights). Next, convert the fonts to web font files using Transfonter. Upload web font files to the wp-uploads folder, and add the custom font to CSS.
WP Rocket, CAOS Analytics, and the Local Google Analytics for WordPress plugin will fix the “leverage browser caching” error in GTmetrix when using Google Analytics. I use WP Rocket.
Loading Google AdSense asynchronously and Cloudflare Rocket Loader can help optimize Google AdSense, but this is the biggest GTmetrix killer of them all. It’s basically a trade for monetization over performance, and there is little you can do to make AdSense load faster.
Embedded YouTube Videos
If you’re using WP Rocket, they have an option to lazy load videos and replace the iframe with a preview image (making it so videos are only loaded once people click the play button). If you’re not using WP Rocket, WP YouTube Lyte is a good alternative. This can shave multiple seconds off your initial load times and is easy. Many embedded videos can take over 2 seconds.
Embedded Tweets, Facebook, And Instagram Posts
If you embed posts on your website, consider taking screenshots and replacing it with an image (see the reduce server response time section for an example). I used a 2-column layout and took screenshots of Facebook polls. Now, they don’t have to pull requests from Facebook.
If you have lots of comments on your blog, you probably know how much Gravatars and even some commenting plugins can slow down your site. I decided to disable Gravatars since I’m picky about my load times, but you can also try Harrys, FV, and Optimum Gravatar cache. None of those plugins worked for me though. Your other option is to break or hide comments.
Social Sharing Plugins
Social sharing buttons pull external requests from Facebook, Twitter, and other social networks. If your plugin has an option to update “like counts” you can adjust it so they’re not updated as often. Otherwise, I recommend one of these lightweight social sharing plugins:
- Social Sharing Plugin
- Social Media Share Buttons (Mashable)
- Social Sharing For WordPress
- AddToAny Share Buttons
- WP Social Sharing
- Easy Social Share
6. Serve Scaled Images
Serving scaled images means you need to resize large images to be smaller.
GTmetrix tells you which images are too large and the correct dimensions they should be resized to. All you have to do is resize them then replace the old images with the new one.
It’s a good idea to create an image dimensions cheat sheet so you know the dimensions of all your different images. For example, your sliders might be 1024 x 400px while your widget images are 300 x 300px, or your fullwidth blog images might be 680px width (like mine). So before I create any image, I know it has to be resized to those dimensions for it to load fast.
Sample Image Dimension Cheat Sheet:
- Logo: 300 x 100px
- Sliders: 1024 x 400px
- Widgets: 300 x 300px
- Featured post images: 350 x 350px
- Fullwidth blog images: 680px (width)
If you have serve scale images errors, you will need to fix those manually without a plugin. But once you get familiar with sizing your images properly, you should never have that error again.
7. Compress Images
ShortPixel, Imagify, and Smush are 3 top plugins for this.
Install one of those plugins (I use ShortPixel), sign up with an API key, then bulk compress all images on your site. Of course, you should check your settings, test a few images, and backup your images before bulk optimizing. Even if plugins say “lossless” there is almost always a small quality drop. This is a photographer’s dilemma – if speed is more important, do it. If not, don’t!
8. Setup Cloudflare’s CDN
There’s no reason not to use Cloudflare’s free CDN.
It hosts your website on 200+ data centers, makes it more secure, and has tons of features inside their dashboard. If you haven’t setup Cloudflare and changed nameservers, I’d do that.
If you already have Cloudflare, here are a few extra speed optimizations:
- Setup Page Rules to save bandwidth and secure your wp-admin
- Configure Cloudflare’s speed settings to get the most out of their service
- Enable Hotlink Protection to prevent people from using image bandwidth
- Let your cache plugin take care of minification, then disable it in Cloudflare
9. Consider Multiple CDNs
Multiple CDNs = more data centers = faster delivery of your content.
I use both Cloudflare and StackPath. Smaller websites should be fine with just Cloudflare, but if you’re serious about speed I would consider an additional CDN. StackPath has excellent support and they will help configure the optimal settings if requested. KeyCDN is good too.
With other CDNs besides Cloudflare, they will generate a CDN URL which you will paste into your cache plugin (most cache plugins have a CDN URL field) or use the CDN Enabler plugin.
10. Make Plugins Load Faster
We all know plugins can destroy GTmetrix scores, so here are some tips for optimizing them.
11. Limit Post Revisions + Autosaves
By default, WordPress automatically saves each post revision, and also continuously saves drafts when editing them. Saving drafts can be a waste of server resources, and storing thousands of post revisions can bloat your database, so we’ll at least tweak these settings.
Add this to your wp-config.php:
define( 'AUTOSAVE_INTERVAL', 60*60*60*24*365 ); // Set autosave interval to 1x per year
You can also disable autosaves and limit post revisions using Perfmatters or Clearfy.
12. Block Spam Bots From Hitting Your Site
Spam bots are a waste of server resources.
They hit your site repeatedly and consume server resources, without any benefit. And without checking whether they’re hitting your site (use Wordfence), you wouldn’t know they’re there.
Step 1: Find spam bots using Wordfence’s live traffic report. If you see the same bot constantly hitting your site, Google it’s hostname and see if other people have reported it as spam. Googlebot and other legitimate bots are obviously fine, but bots like amazon.aws and linode have been reported as problems. These 2 bots were hitting my own site nearly every second!
Step 2: Block spam bots using Cloudflare Firewall Rules, BBQ, Blackhole, or Wordfence. I would personally use Cloudflare’s firewall rulers if you only have a few primary spam bots to block, since Wordfence itself can cause high CPU. To review, find the spam bots in Wordfence, block the spam bots using Cloudflare, then delete Wordfence so it’s doesn’t consume CPU.
13. Reduce Server Response Times To <200ms
Your server (hosting) is the #1 factor in the WordPress optimization guide.
To check your server response time, run your site through Google PageSpeed Insights:
Whatever you do, avoid GoDaddy and EIG who owns 60+ different hosting companies including Bluehost, HostGator, iPage, Site5, and others. They’re infamous for slow servers.
Many people who already migrated to SiteGround, Cloudways, and Kinsta have posted screenshots of their new load times on Twitter. Some people saw an improvement of 7s.
There’s a lot of bad information out there – even hosting reviews on YouTube recommend companies like Bluehost, HostGator, or even HostPapa. This is completely ridiculous; do your research in Facebook Groups and look at what real people are saying on Facebook + Twitter.
SiteGround and Cloudways will both migrate you for free.
14. Disable WooCommerce Scripts, Styles, Cart Fragments
This is partially because WooCommerce adds scripts, styles, and cart fragments to every single page on your site (even non-eCommerce pages). Just like you shouldn’t let some plugins run on every page (tip #2), you shouldn’t let WooCommerce options run on non-eCommerce pages. You can disable all these in 1-click using the Perfmatters plugin by Kinsta (which also lets you selectively disable plugins/scripts), otherwise you can use these codes from Github.
Disable WooCommerce Scripts:
Disable WooCommerce Styles: see Woocommerce’s documentation.
Disable WooCommerce Cart Fragments:
15. Post Your GTmetrix Report In Facebook Groups
If you still need help, there are Facebook Groups where people are happy to provide feedback. Feel free to also leave me a comment, check out my full WordPress speed guide, or hire my team for WordPress speed optimization who will send you before and after GTmetrix reports.
Recommended Facebook Groups
Hope this was helpful.