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
Hosting is the #1 factor in the WordPress optimization guide.
Run your website through Google PageSpeed Insights and check if reduce server response times is in your report. Google recommends a response time of <200ms. You can also check your TTFB (time to first byte) in the GTmetrix Timings tab. If these are slow, so is your hosting.
I would personally skip the shared crap and go with Cloudways.
They’re who most people recommend in the WordPress Hosting Facebook Group and #1 in most recent Facebook polls, especially since SiteGround increased prices and went downhill. I migrated from SiteGround to DigitalOcean on Cloudways and you can view the results below.
I use them and you can check my GTmetrix report, or visit cwdoserver.com to see the speed of a $10/month Cloudways DigitalOcean test server I set up with an Astra Site. It loads instantly (for reference, stgrndserver.com is the identical Astra Site only on SiteGround’s GrowBig plan).
I signed up for 15+ hosting accounts to test their speed. All domains in this video are live, which means you can visit them in real-time and click through their pages, use GTmetrix, etc.
Each website is identical except for it’s hosting (same Astra Starter Site, SSL, no caching, no CDN, and the same 6 plugins). I also used WP Hosting Performance Check and KeyCDN to measure 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.
2. Rethink Your Theme + 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 upgrading the latest version of PHP.
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. Enable Varnish + Memcached
Many cloud hosting providers support Varnish + Memcached. Login to your hosting account and activate them. If you’re using Varnish, be sure to enable the Varnish addon in WP Rocket.
6. Use A CDN
Most people use Cloudflare or RocketCDN (from WP Rocket).
RocketCDN uses StackPath’s data centers and offers it at a lower price than if you buy directly from StackPath. Both are great CDNs, but there are a few major differences between the two.
Cloudflare vs. RocketCDN
- Cloudflare is free, RocketCDN is $6.99/month
- Cloudflare cannot serve images from their CDN, StackPath can
- Cloudflare has 200+ data centers, StackPath has 45 data centers
- Cloudlare’s data centers are likely not as high-performance as StackPath
- Cloudflare has a dashboard you can login to and tweak, RocketCDN does not
- Cloudflare’s dashboard has extra features like page rules, Rocket Loader, Railgun
- Cloudflare requires changing nameservers (some hosts also have an option to activate Cloudflare directly from your account), StackPath’s set up is automatic with WP Rocket
Ensure Cloudflare Compatibility With WP Rocket – WP Rocket and most other cache plugins ask for your Cloudflare Zone ID, Global API Key, and your Cloudflare account email. Add them.
Configuring The Cloudflare Dashboard – if you’re using Cloudflare, login to your dashboard. There are a few things in here that aren’t available if you set up Cloudflare through your host.
- 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, below are the 3 I recommend)
Setting Up RocketCDN Or StackPath – the easiest way to set up RocketCDN is with WP Rocket. If not using WP Rocket, you will need to sign up for a StackPath account through their website then follow instructions for creating a CDN site. They will assign you a CDN URL which most cache plugins (including Autoptimize) have a field for. Or use the CDN Enabler plugin.
Make Sure Your CDN Is Working – every CDN should show 100% in GTmetrix YSlow except Cloudflare’s CDN. To make GTmetrix detects Cloudflare, you’ll need to sign up for a GTmetrix account → User settings → “add your hostname to YSlow CDN Hostnames.” You can also use Cloudflare’s Claire Chrome Extension to see if it’s working. GTmetrix always detects StackPath.
7. Avoid 65+ Slow 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).
8. 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 other 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.
9. 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 – grab the URLs of your font files in the GTmetrix Waterfall report and 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.
10. 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 (the UA code) into the plugin, then use the “Minimal Analytics Inlined” method which only adds a measly 1.4KB.
11. Google AdSense
12. 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).
13. 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.
14. Facebook Pixel
15. Use A Fast Social Sharing Plugin
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.
16. Optimize Images + 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 image 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.
17. 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 their CPU limits). Especially if you anticipate high resource consumption, make sure your hosting plan includes enough resources to properly accommodate your site.
18. Clean Your Database
Use WP Rocket or WP Optimize to clean your database.
Ongoing cleanups keep your database optimized and removes transients, spam + trash comments, and potentially hundreds of post revisions which WordPress stores automatically every time you update content. Unless you need post revisions to restore backups of old content, you should be able to delete everything. I recommend scheduling weekly cleanups.
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.”
19. 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.
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. 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 allows 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.
22. 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.
23. Don’t Enable Yoast Indexables
Yoast 14.0 came out with indexables which they claim “can provide a speed boost of 5-10%.”
However, if you look at the comments, it’s clear they have not thoroughly tested this (many complaints about CPU spikes, crashed websites, errors, etc). None of the feedback looks positive, so I would at least hold off of clicking that button until they do more thorough testing.
24. Utilize Plugins By Gijo Varghese
Gijo Varghese has create quite a few plugins for speeding up WordPress.
These plugins help you host Google Analytics locally, optimize images and serve them from a CDN, preload pages, delay loading scripts by creating a timeout, and ensure text remains visible while loading fonts. All have great ratings. Check out his WP Speed Matters Facebook Group.
25. 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.
26. 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 website is getting sluggish, go to WooCommerce Status settings → delete all transients. Transients temporarily store cached data in your database.
27. Block Bad Bots From Using 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.
28. 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 :-)