Have a slow WordPress site?
This post you’re reading has over 70 images, 470 comments (while showing Gravatars), uses external fonts, Google Analytics, social sharing buttons, and an embedded YouTube video. Yet, it can load in under 2s with a 2.56MB page size, 89 requests, and 100%/97% GTmetrix scores.
So thanks for choosing mine!
I’ll show you how to take your GTmetrix + PageSpeed Insights report and make WordPress-specific optimizations that improve grades/load times. I’ve already written popular guides on WP Rocket, slow plugins to avoid, and a list of 24+ speed plugins. This combines everything.
When in doubt, look at the WordPress optimization guide to see the most important factors. The most common fixes for a slow WordPress site are usually related to your infrastructure (theme, hosting, page builder, cache plugin, CDN, and plugins you’re using). While optimizing images and third party scripts can definitely speed up WordPress, most factors are site-wide.
For this, I recommend Cloudways or Kinsta (hosting), Astra or Oxygen Builder (theme + page builder), and WP Rocket (main optimization plugin). You will avoid 90% of speed issues and they’re all rated highly in Facebook polls. Comment with your GTmetrix report if you need help.
GTmetrix (load times) should be your primary metric while PageSpeed Insights doesn’t even measure load times. Getting 100% in every single tool is not realistic unless you have a bare bones, static HTML site. Don’t obsess over scores – obsess over your actual load times instead.
Watch My Video – it’s a 42 minute video, but I cover pretty much everything (timestamps are found in video description). You will learn a ton of good stuff on WordPress speed optimization.
1. Use Faster WordPress Hosting
All domains shown in this video are live, which means you can test the speed of 15+ different hosting companies in real-time by clicking through pages, running them through GTmetrix, etc.
Each website is identical except for the hosting. I signed up for 15+ different hosting accounts and installed the same Astra Starter Site (Outdoor Adventure) on every website. They all use SSL, no caching, no CDN, and the same 6 plugins. I strictly wanted to measure hosting speeds.
In the video, I also used the WP Hosting Performance Check plugin and KeyCDN to measure some of the most popular options. The results align with what most people are saying in the WordPress Hosting Facebook Group which I recommend joining to get real, unbiased opinions.
Here they are:
I use DigitalOcean on Cloudways who is also listed in the WordPress Optimization Guide.
I would personally skip shared hosting since cloud hosting is exponentially faster. This is especially true if you’re on GoDaddy or EIG brands (eg. Bluehost and HostGator) and for resource-intensive websites running WooCommerce, WPML, page builders, or slow plugins.
There are plenty of migration results if you check Twitter and Facebook Groups. Avoid the bloggers promoting Bluehost and WP Engine because they have the highest commissions and do your research. Hosting is the #1 factor in WordPress’ optimization guide – very important!
How To Check If Your Hosting Is Slow
- Slow server response time in PageSpeed Insights
- High TTFB (time to first byte) in GTmetrix Timings tab
- Your website has good GTmetrix scores, but a poor load time
- 503 server unavailable errors (means the server is overloaded)
2. Rethink Your Theme And Page Builder
Most people are using Astra Themes.
The only problem with Astra is that most of their themes use page builders. Even Elementor adds a lot of scripts that can mildly slow down your WordPress site (you can check these in Asset CleanUp or Perfmatters). That was my biggest complaint when I had my site redesigned in Astra (I even went themeless). My StudioPress theme was slightly faster with 0 extra scripts.
It really depends on what you want; if you like Astra + Elementor for designing your site and don’t mind a slight decrease in speed, that’s what I would recommend. If you’re a speed freak like me and only want the fastest stuff, I wish I would have stuck with StudioPress and Genesis.
I recommend either Astra or Oxygen Builder.
3. Configure A Solid Cache Plugin
As far as GTmetrix scores go, your cache plugin has the biggest impact.
WP Rocket is the most popular cache plugin (it’s also what I use) mainly because it comes with more speed optimization features than any other cache plugin. This not only results in better GTmetrix scores, but also means you don’t have to install a bunch of extra plugins on your site.
With most other cache plugins, you would need to install about 7 extra plugins to get these features when WP Rocket has them all built-in. Otherwise you will need to research which features your cache plugin comes with, then install these plugins if it doesn’t support them.
- Database cleanup (built-in to WP Rocket, or use WP-Optimize)
- Heartbeat control (built-in to WP Rocket, or use Heartbeat Control)
- Lazy load images/videos (built-in to WP Rocket, or use WP YouTube Lyte)
- Host Google Fonts locally (built-in to WP Rocket, or use OMGF, or SHGF)
- Host Google Analytics locally (built-in to WP Rocket, or use Flying Analytics)
- Prefetch DNS requests (built-in to WP Rocket, or use Pre* Party Resource Hints)
- Integration with Cloudflare + other CDNs (built-in to WP Rocket, or use CDN Enabler)
What About SG Optimizer? If you’re on SiteGround, use their SG Optimizer plugin (instead of WP Rocket) with these SG Optimizer settings. It’s free and comparable to WP Rocket (you will still need heartbeat control and database cleanup). This plugin is only for SiteGround’s hosting.
4. Upgrade To PHP 7.4
Login to your hosting account (or use the Display PHP Version plugin) to see which PHP version you’re currently running. WordPress stats show most users are running outdated PHP versions when PHP 7.4 is available on many hosting accounts. Upgrading is as simple as finding the PHP Version Manager (or similar) in your hosting account, then selecting the latest version.
Some hosts are quick to release new versions (SiteGround, Cloudways, Kinsta), while others don’t make an effort to stay current in technology. Another reason to avoid EIG and GoDaddy.
5. Configure Cloudflare’s CDN
CDNs host your website files on multiple data centers around the world, helping to offload bandwidth to their data centers. This should not only make your website faster, but also lighten the load on your server to help improve server response times while reducing hosting costs.
Step 1: Sign Up For Cloudflare’s Free CDN
Cloudflare’s free CDN can be activated in many hosting accounts (eg. SiteGround, Bluehost), otherwise you will need to sign up for Cloudflare, add your website, and change nameservers.
Step 2: Make Your Cache Plugin Compatible With Cloudflare
WP Rocket and most cache plugins ask for your Cloudflare Zone ID, Global API Key, and Cloudflare account email. These are found in your account. Add them to your cache plugin.
Step 3: Configure Settings + Page Rules In Cloudflare
Login to your Cloudflare dashboard. There are quite a few things here that aren’t available if you setup Cloudflare through your hosting provider (that’s why you have to login to the actual Cloudflare dashboard). There are a few settings that can improve your WordPress site speed.
- Enable Brotli (Speed Settings)
- Enable Railgun (Speed Settings)
- Enable Rocket Loader (Speed Settings)
- Enable hotlink protection (Scrape Shield Settings)
- Setup page rules for WordPress (Page Rules Settings)
Step 4: Consider Additional CDNs
StackPath is another CDN which offloads even more bandwidth to their 31 data centers. Should you use multiple CDNs? Some say yes, some say no. I’ve had great results using both Cloudflare + StackPath and you can see I’m saving a ton of bandwidth with StackPath’s CDN. They have a 30-day free trial and a tutorial for setting up a full-site CDN (preferred method).
Step 5: Make Sure Cloudflare Is Working
Every CDN besides Cloudflare makes this green (it’s just the way Cloudflare is set up). Don’t worry if it’s not – as long as Cloudflare is working (you can check with their Chrome Extension) and is offloading bandwidth which you can check in Cloudflare’s analytics, that’s what matters.
6. Avoid 65+ Slow Loading Plugins
You can find your slowest plugins in the GTmetrix Waterfall tab or Query Monitor.
Lightweight Plugin Alternatives
- Page Builders – Oxygen.
- Social Sharing – see WP Rocket’s test (I use Grow by Mediavine)
- Backup – UpdraftPlus.
- Sliders – Soliloquy, LayerSlider, or Meteor Sliders.
- Portfolio – Envira Gallery, FooGallery, or The Grid.
- Analytics – Google Analytics and Search Console is plenty.
- StudioPress Plugins – lightweight plugins for Genesis Framework.
- Comments – native comments or wpDiscuz (see comments + Gravatars section).
7. Optimize Third Party Scripts
Third party scripts are anything that create requests from external websites.
These include Google Fonts, Analytics, Maps, AdSense, Tag Manager, embedded videos, social media widgets, Facebook Pixel, Gravatars, or even like buttons from your social sharing plugin. Some can be optimized to have no impact on GTmetrix while AdSense/Tag Manager are harder.
Common third party domains taken from Github:
Step 2: Add Domains To Prefetching
Take the external scripts from your GTmetrix report and add them to WP Rocket (Preload → Prefetch DNS Requests). Prefetching and browser resource hints makes them load faster. If you don’t have WP Rocket, you can do this with Perfmatters or Pre* Party Resources Hints.
Step 3: Use Flying Scripts To Delay Loading Them
Don’t forget to see the next few sections which will help you better optimize external scripts.
8. Google Fonts
Here are 4 steps for optimizing Google Fonts and Font Awesome.
Optimize Fonts With WP Rocket Or SG Optimizer – both WP Rocket and SG Optimizer have an option to optimize Google Fonts. This combines your fonts to create fewer HTTP requests.
Host Google Fonts Locally – use the OMGF plugin to host fonts locally. The plugin will automatically download your fonts, create a stylesheet for them, then include it in the header.
Preload Fonts – find the URLs of your font files in the GTmetrix Waterfall, then add them to WP Rocket’s “preload fonts” option, or in OMGF. This helps browsers download fonts faster.
Be Minimal With Fonts + Weights – be minimal with the number of fonts and weights.
9. Google Analytics
Hosting Google Analytics locally will fix the leverage browser caching issue for Google Analytics in GTmetrix. For this, I use the Flying Analytics plugin since WP Rocket’s Google Tracking add-on still showed errors. Insert your Google Analytics Tracking ID (UA code) into the plugin, then use the “Minimal Analytics Inlined” method which only adds a measly 1.4KB.
10. Google AdSense
11. Google Tag Manager
GTM should usually only be used for large, unoptimized sites.
If you absolutely need it, use a good Google Tag Manager plugin and be minimal with tags, but that’s about all you can do. I don’t use GTM on my website (my load times are more important).
12. Comments + Gravatars
I use 3 plugins for comments which you’ll see zero errors for in GTmetrix.
- wpDiscuz: commenting plugin.
- Flying Scripts: delays loading of Gravatars.
- WP User Avatar: use a custom, optimized photo as the default avatar.
Step 1: Configure wpDiscuz to load faster.
Comment thread displaying → initiate AJAX loading after page and lazy load comment.
General → disable “use WordPress native AJAX functions” and enable combine/minify JS/CSS.
Styles and colors → disable “load font awesome CSS lib.”
Step 2: Delay Gravatar loading with the Flying Scripts plugin.
Step 3: Upload a custom, optimized photo using WP User Avatar.
Retest your GTmetrix report and your comments should load much faster with no errors.
13. Social Sharing Plugins
WP Rocket did a test on the fastest social sharing plugins.
The Grow by Mediavine plugin (Social Pug) was rated the #1 fastest social sharing plugin. It’s also what I use and saw no difference in my GTmetrix report. You can see a preview near my comments section; the buttons look nice, can be loaded before and after the content, and has options for Facebook, Twitter, Pinterest, LinkedIn, email, print. You can also do a floating bar.
14. Facebook Pixel
15. Optimize Images And Videos
There are several ways to optimize images. The first 3 items are in GTmetrix, the last 2 are from PageSpeed Insights. Speed testing tools only show you unoptimized images for the single page you test (keep that in mind when fixing serve scaled image or specify image dimension errors).
- Serve scaled images – resize large images to be smaller.
- Specify image dimensions – add a width/height to the image’s HTML.
- Lossless compress – use an image optimization plugin to compress images.
- Lazy load images + videos – delays load of images/videos until they’re visibly seen.
- Serve images using next-gen formats – use WebP/SVG format instead of JPEG/PNG.
Serve Scaled Images – resize large images to be smaller. GTmetrix tells you the correct dimensions. Just click the image in GTmetrix, resize it to the new dimensions, and replace it. Never use the ‘drag to resize’ feature in the visual editor since this only resizes the displayed image (not the actual image). It’s best to resize to the correct dimensions before uploading it.
Create a cheat sheet so you can use the correct dimensions before uploading images:
- Slider images: 1903(w) x 400(h)
- Carousel images: 115(h)
- Widget images: 414(w)
- Full width blog post images: 680(w)
- Featured images: 250(w) x 250(h)
Specify Image Dimensions – means you need to add a width + height in the image’s HTML or CSS. This usually only happens for hand-coded HTML and plugins that don’t take care of this for you. Get the dimensions from GTmetrix, locate the image, then add the width and height:
Optimize Images – losslessly compress images (also known as “optimize images” in GTmetrix). The best way to compress images is when you’re editing them (eg. in Photoshop or GIMP) since you will likely see a loss in quality with image optimization plugins, even if you select “lossless compression” in the settings. Otherwise, ShortPixel or Imagify are decent options. These plugins can also be resource-intensive and slow down your WordPress website temporarily.
Lazy Load Images + Videos – in your WP Rocket Media settings, enable lazy loading of images, videos, and replace the YouTube iframe with a preview image. These will make images and embedded videos load significantly faster, as they’re often the heaviest element on a page. If you’re not using WP Rocket, try A3 Lazy Load (for images) and WP YouTube Lyte (for videos).
Serve Images In Next-Gen Formats – most image optimization plugins have an option to convert images to WebP format, or the WebP Converter For Media plugin has great ratings.
16. Reduce Server Response Times
I want to clarify a few things about server response times.
Most hosting providers let you monitor CPU and RAM (memory usage). If you notice these are very close to exceeding your limits, this will put stress on your server. The whole goal is to make your server “relaxed” by giving it enough server resources to accommodate your site’s resource consumption (from high CPU plugins, traffic, WooCommerce, etc). If you notice you’re almost hitting your limits or exceeding them and getting 503 errors, it means your server is stressed.
That’s why it’s so important to look at how many server resources come with your hosting plan. Any host that says “unlimited bandwidth” is lying (just check their terms and conditions page and they will mention CPU limits). Especially if you anticipate high resource consumption, make sure your hosting plan includes enough resources to properly accommodate your site.
You truly get what you pay for.
17. Remove Junk From Your Database
You can use WP Rocket or WP Optimize to clean your database.
Scheduling ongoing cleanups help keep your database tables optimized and removes transients, spam + trash comments, and potentially hundreds of post revisions which WordPress stores automatically anytime you update a page or post. Unless you need post revisions to restore backups of your old content, these are, for the most part, complete trash.
Delete Old Plugin Tables – one thing I like about WP-Optimize is the option to delete database tables left behind by old plugins that aren’t installed anymore (these are often pre-configured settings). If you don’t plan on using these plugins again, delete the tables that say “not installed.”
18. Remove Bloat
Perfmatters (by Kinsta) is the ultimate bloat removal plugin.
The features page includes descriptions of what each item does, but it removes unnecessary WordPress features which you probably don’t need. It even has options for optimizing your Google Analytics tracking code, WooCommerce, prefetch + preconnect, and heartbeat control. Remember to selectively disable plugins in the Perfmatters script manager or Asset CleanUp!
Limit Post Revisions – use Perfmatters or add the code to your wp-config file.
Increase Autosave Interval – use Perfmatters or add the code to your wp-config.php file.
define('AUTOSAVE INTERVAL', 5);
Disable Trackbacks + Pingbacks – use Perfmatters or disable in Settings → Discussion.
Disable Unused Addons + Modules – if you’re using a plugin containing a bunch of addons or modules (Elementor, Ultimate/Premium Addons, JetPack), delete the ones you’re not using.
Delete Unused Plugins + Themes – any plugins/themes you’re not using should be deleted.
19. Disable Plugins On Specific Pages + Posts
The Perfmatters script manager (premium) and Asset CleanUp (free) both let you disable plugins/scripts from running on specific pages/posts. Some plugins load across your entire site (even on content they’re not being used on), so it’s best to disable them when that’s the case.
- Disable slider plugin on pages that don’t use sliders
- Disable rich snippets plugin on pages that don’t use rich snippets
- Disable contact form plugin on pages that don’t have a contact form
- Disable affiliate link management plugin on pages that don’t use aff links
- Disable social sharing plugin on all pages (since it’s usually for blog posts)
Perfmatters and Asset CleanUp (the premium version) have a Regex option that lets you disable plugins/scripts based on specific URL patterns and categories. For example, you may want to only enable your schema plugin on posts containing the word “review” in the URL.
20. Disable Plugin Usage Tracking
Any time you have an option to disable usage tracking, do it. Sorry plugin developers.
I also don’t recommend Yoast’s speed indexing (the comments have horrible reviews).
21. Minimize Redirects
If you have URL redirect errors in GTmetrix, it usually means you changed the WWW or HTTP(S) version of your website but didn’t change all your links and images to reflect the new version. In this case, try using the Better Search & Replace plugin to fix these errors in bulk.
Third party scripts and poorly coded plugins can also cause redirect errors in GTmetrix. The solution completely depends on which plugins and third party scripts you’re using on the site.
22. Increase Memory Limit To 256MB
WooCommerce and WPML require a 256MB memory limit, but you should really be using 256MB no matter which type of WordPress site you’re running. Some hosts have an option to increase it in their dashboard, otherwise edit your wp-config.php file and add the code below.
23. Make WooCommerce Load Faster
WooCommerce sites run extra scripts, styles, cart fragments, and they usually require more plugins. That’s why when choosing a hosting plan, you should usually buy one tier up of what you actually need to accomodate for the extra resources often required for WooCommerce.
Optimize WooCommerce Scripts, Styles, Cart Fragments
To optimize these, use Perfmatters or there are quite a few solutions on Github and WooCommerce. Disabling scripts will disable WooCommerce scripts and styles everywhere except on product, cart, and checkout pages. There’s also an option to disable cart fragments.
Clear WooCommerce Transients
If you feel like your WooCommerce site is getting sluggish, go to WooCommerce Status settings → delete all transients. Transients store cached data temporarily in the database.
24. Block Bad Bots From Consuming Resources
You would never know if spam bots are hitting your site unless you checked your Wordfence live traffic report. By blocking them, you will save resources and put less stress on your server.
Step 1: Install Wordfence (you’ll want to uninstall it when you’re done).
Step 2: View your live traffic report (under Wordfence’s Tools settings) which shows you all bots hitting your website in real-time. Googlebot is obviously OK, but when I did this, I saw compute.amazonaws.com making a ridiculous amount of requests every couple seconds. I Googled it and sure enough, this was a bot known for sucking up bandwidth. View your report for a minute or two and see if bots with sketchy names are constantly hitting your site. If you have doubts, Google their hostnames and see if other people are having issues with that bot.
Step 3: Block the bots. You have a few options: Wordfence blocking (however the plugin itself consumes resources), Cloudflare firewall rules (comes with 5 free rules which means you can block 5 bots), or the Blackhole For Bad Bots. I have a tutorial for blocking bad bots using all 3 methods. It depends on how many you want to block; if it’s only a few, I’d use Firewall Rules.
Login to your Cloudflare Dashboard and go to Firewall → Firewall Rules → Create A Firewall Rule. Copy the bad bot’s hostnames (from Wordfence) and add it here in the “Value” field. Since you can create 5 rules, you would repeat this step for your 5 worst bad bots from Wordfence.
- Field = Hostname
- Operator = Contains
- Value = hostname of the bad bot you found in Wordfence
Step 4: Go to your Blocking log in Cloudflare and watch your spam bots get blocked.
25. Identify Bottlenecks In Speed Testing Tools
GTmetrix – my tool of choice since you can find exactly which images, plugins, fonts, and external scripts take longest to load (plus it shows your time to first byte and redirect errors).
Pingdom – the most accurate tool for measuring your load times according to WP Rocket which is the primary metric you should be measuring (not grades), but there is a correlation.
Google PageSpeed Insights – good for measuring server response times but also has other recommendations like using next-gen format for images (eg. WebP), lazy loading, avoid third party scripts, preconnect, minification, caching recommendations, and serving scaled images.
Query Monitor – great for finding slow plugins, scripts, styles, and other elements slowing down your site. Make sure to delete it when you’re done since the plugin itself can be slow.
Get Help Fixing Your GTmetrix Report
Frequently Asked Questions
🚀 What are the most important speed factors?
Your infrastructure (hosting, theme, plugins, page builder, CDNs) have the biggest impact on load times.
🚀 Which cache plugin should you use?
WP Rocket is usually rated the top cache plugin in Facebook polls since it has built-in features most cache plugins don't. These extra optimizations should yield better scores and load times in GTmetrix. The top free cache plugins are usually WP Fastest Cache, W3 Total Cache, and Swift Performance.
🚀 Which WordPress hosting should you use?
The best hosting is highly debatable, but Cloudways, SiteGround, and Kinsta generally the top 3 hosts based on 30+ Facebook polls.
🚀 Which speed testing tool should you use?
GTmetrix has the most robust recommendations especially for finding slow plugins, images, external scripts, and measuring TFFB. Pingdom doesn't have as many recommendations, and Google PageSpeed Insights doesn't measure load times.
🚀 How do you optimize images?
You can optimize images using a plugin like ShortPixel or Smush to compress images and strip EXIF data. Make sure you're resizing images to the correct dimensions, and ideally serve them from a CDN. Lazy loading images and videos will also make the page faster.
🚀 Should you use AMP?
Generally, you should avoid AMP (accelerated mobile pages) since the design changes can lower conversions. Kinsta's conversions dropped 59% after adding AMP and they decided to remove them.
🚀 How do you optimize plugins?
Find high CPU plugins using Query Monitor which usually include portfolios, statistics, sliders, and plugins that run ongoing processes. Next, replace them with lightweight plugins that consume minimal resources. Delete all plugins you're not using, and disable unnecessary plugin settings that consume resources. Finally, selectively disable plugins from loading on certain content using a plugin like Asset Manager or Perfmatters.
🚀 How do you optimize external scripts?
Really hope this helped! Drop your new GTmetrix scores + load times in the comments :-)