A slow site shows itself the moment a page opens. If you are wondering how to speed up WordPress, start by measuring, so you can see what is actually slow instead of installing plugins at random.
In this guide we first measure the site with PageSpeed Insights. Then we go through five changes, and after each one you check whether it helped. They are a page cache, lighter images, a new PHP version, fewer plugins and Cloudflare. There is a checklist at the end.
How to measure how slow the site is
Open PageSpeed Insights, enter the address of the page and press Analyze. Check the home page and at least one more that brings you customers, for example a product page or a contact page.
The result has two parts. The first shows data from real visitors in Chrome over the last 28 days. For a new site, or one with few visits, it may be missing. The second is a Lighthouse test, which loads the page in a simulated environment, separately for mobile and for desktop.
The most important are the three metrics Google calls Core Web Vitals. They are assessed at the 75th percentile of page loads, which means at least three out of every four visits should land in the good range.
| Metric | What it measures | Good | Poor |
|---|---|---|---|
| LCP | When the largest element on the screen appears, usually an image or a block of text | up to 2.5 seconds | over 4 seconds |
| INP | How quickly the site reacts to a click, a tap and a key press | up to 200 milliseconds | over 500 milliseconds |
| CLS | How much the content jumps while the page loads | up to 0.1 | over 0.25 |
Add the time to first byte (TTFB) to these. It is not part of Core Web Vitals, but it shows how quickly the server starts to answer. A good value is up to 0.8 seconds.
How to speed up WordPress with a page cache
Without a cache, WordPress runs PHP and asks the database on every load to put the page together. A cache plugin saves the finished page as a static file and hands it to the next visitors without that work. According to the WordPress documentation, this lowers the load on the server.
One cache plugin is enough. Which one depends on the server, so check what it is first.
Which plugin to choose
The command sends a request to the site and shows only the line with the server name. Run it from your computer or, if you are on Windows, from Terminal in cPanel.
# Your computer or cPanel > Terminal. Shows the web server of the site.
curl -sI https://primer.bg/ | grep -i '^server:'
If you see LiteSpeed, choose LiteSpeed Cache. If you see nginx or Apache, choose a general plugin from the table below. If you see cloudflare, the site is behind Cloudflare and the header does not show the server behind it, so ask your host.
| Plugin | What to know |
|---|---|
| LiteSpeed Cache | Its page cache needs LiteSpeed or the QUIC.cloud service. Its other settings work on any server. |
| WP Super Cache | Makes static HTML files. The author is Automattic, and the recommended Simple mode does not change .htaccess. |
| W3 Total Cache | Caches pages, caches files in the browser and connects to a CDN. |
| WP Fastest Cache | Has a free and a paid version, and some of the features are only in the paid one. |
| Cache Enabler | Saves the finished pages as static HTML files on disk. |
If you have no preference, WP Super Cache in Simple mode is an easy start, because it does not change .htaccess.
How to turn it on and check that it works
Make a backup of the site before the change. Then open the Plugins menu, choose Add New, search for the plugin and press Install Now and Activate. Leave the default settings and look at the site in a private window, to see it as a visitor.
Minifying and combining CSS and JS files sometimes breaks the look of the site. Turn these options on one by one and open the site after each. LiteSpeed's guide shows how to find the file that causes the problem.
In a WooCommerce shop, the Cart, Checkout and My Account pages must not be cached, because they show the data of one customer. Many plugins exclude them on their own, but check.
To see whether the cache works, measure the time to first byte twice in a row.
# Computer or Terminal. Run it twice, the second value is smaller.
curl -s -o /dev/null -w "%{time_starttransfer}\n" https://primer.bg/
# For LiteSpeed Cache only. The second load should return hit.
curl -sI https://primer.bg/ | grep -i '^x-litespeed-cache:'
The first load after turning the cache on is slower, because the plugin is still saving the page. If both values are high, the cache is not working.
How to make images lighter
WordPress creates several smaller copies of every uploaded image and lets the browser pick the one that suits the screen. Even so, there is no point in uploading an original at a size no screen will ever show. Start by finding which images are the heaviest.
# cPanel > Terminal, in the site folder. Read-only, changes nothing.
find wp-content/uploads -type f -size +500k -exec du -h {} + \
| sort -rh | head -n 20
The command lists up to twenty files over 500 KB, the largest first. Shrink those images to the width at which they appear on the widest screen and upload them again.
The next step is the format. WordPress has accepted WebP since version 5.8, and according to the WordPress team, WebP files are on average about 30% smaller than JPEG and PNG. If the server does not support WebP, WordPress returns an error on upload, and then you should ask your host.
For new images, use the Modern Image Formats plugin from the WordPress performance team, which adds WebP and AVIF support on upload.
For images already in the library, use an optimization plugin, for example EWWW Image Optimizer or ShortPixel. EWWW converts the whole library to WebP in one go. ShortPixel requires an account and gives a limited number of free credits per month. One image plugin is enough.
WordPress does lazy loading on its own. Since version 5.5 it adds loading="lazy" to the images in the content that have width and height set, so you do not need a second plugin for this.
But the image that is visible as soon as the page opens should not be lazy loaded. Since version 6.3 WordPress marks the image that is most likely the LCP image with fetchpriority="high" and does not lazy load it.
If the theme or the page builder prints images with its own code, the rule may not apply. Open the page, choose View page source from the right-click menu and search for loading="lazy" next to the first large image.
Which PHP version does the site use, and should you change it?
PHP is the language WordPress runs on. The WordPress documentation says newer PHP versions usually bring better performance, and its page about updating PHP adds that the site may become faster and more secure.
Check the version under Tools, Site Health, the Info tab and the Server section. WordPress recommends PHP 8.3 or newer. The oldest version it still works with is PHP 7.4, but that one has reached its end of life and, according to WordPress, may expose the site to vulnerabilities.
Each PHP version gets two years of full support and two more years of security fixes only. That is why a version that is new today will be old in a few years, and you will need to change it again.
Before the change, make a backup, update WordPress, the theme and the plugins, and check that the site works. How to change the version in cPanel is described step by step in the guide Change the PHP version in cPanel without breaking WordPress.
After the change, open the home page, the login and a page with a form. If an error appears, go back to the old version and find out which plugin or theme is not compatible.
How to find the plugin that slows the site down
Among the first measures in the WordPress documentation is to deactivate and delete unnecessary plugins. According to it, the number of plugins and their quality have a big effect on speed.
Open Plugins, then Installed Plugins, and, for each plugin, ask whether the site would work without it. The lists of inactive plugins and themes are also under Tools, Site Health, in the Info tab.
If you need a plugin but suspect it slows the site, install Query Monitor. It shows slow and repeated database queries grouped by plugin or theme, and the requests to external addresses with the time they took. Open the slow page while logged in as an administrator and see which component is behind the most and the slowest queries. After the check, deactivate Query Monitor.
Do not switch plugins off on the live site just to see the difference. Do it on a copy in a subdomain, as described in the backup guide.
How does Cloudflare help as a CDN?
A CDN keeps copies of the static files, that is images, styles and scripts, in data centers closer to the visitors. According to the Cloudflare documentation, this lowers the load on the server and the site loads faster.
By default Cloudflare caches files by extension, such as images, fonts, CSS and JS, but it does not cache HTML and JSON. That is why the page cache from the plugin is still needed. The WordPress documentation also says a CDN works best together with a cache plugin.
Cloudflare's free plan includes the CDN too, so you can start with it.
After you change an image or a style, Cloudflare may still return the old version. In its dashboard open Caching, then Configuration and the Purge Cache section. Purge Everything clears everything and after that every request reaches your server, so if you can, clear only the addresses that changed.
Checklist
- LCP, INP and CLS of the mobile result are written down before the first change.
- There is a backup of the site before the changes.
- One cache plugin is running, and the second time to first byte measurement is lower than the first.
- If there is a shop, the Cart, Checkout and My Account pages are not in the cache.
- The heaviest images are shrunk or replaced with WebP.
- The first large image on the page does not have
loading="lazy". - The site runs on PHP 8.3 or newer.
- Unnecessary plugins are deactivated and deleted.
- The result is measured again and compared with the old numbers.
Do you have to do all of this yourself?
If LCP, INP and CLS of the mobile result are already in the good range, there is nothing to speed up. Measure again after a bigger change, for example a new theme.
If the numbers stay bad after the cache, the images and the new PHP, look at the hosting. The WordPress documentation points out that the processor, the memory and the type of disks affect speed, and that moving to SSD or NVMe can make a big difference.
If you would rather not dig into it yourself, with WordPress speed optimisation we work on caching on several levels, the database, the images and Core Web Vitals, and measure before and after, wherever the site is hosted. If the problem turns out to be the hosting itself, moving to your own server is the next step.
Frequently asked questions
Where do I start if I want to speed up WordPress?
Start by measuring, so you see what is actually slow instead of installing plugins at random. Open PageSpeed Insights, check the home page and at least one more page that brings you customers, and write down the three numbers of the mobile result. Lighthouse gives different numbers on every run, so run the test several times and take the middle result.
What are good values for LCP, INP and CLS?
LCP, the moment the largest element on the screen appears, is good up to 2.5 seconds. INP, how quickly the site reacts to a click or tap, is good up to 200 milliseconds, and CLS, how much the content jumps while loading, is good up to 0.1. They are assessed at the 75th percentile, which means at least three out of every four visits should be in the good range.
Which cache plugin should I choose for WordPress?
It depends on the server. If the server header shows LiteSpeed, choose LiteSpeed Cache, and if it shows nginx or Apache, choose a general plugin such as WP Super Cache, W3 Total Cache or Cache Enabler. With no preference, WP Super Cache in Simple mode is an easy start because it does not change .htaccess, and one cache plugin is enough.
Which WooCommerce pages must not be cached?
The Cart, Checkout and My Account pages, because they show the data of one particular customer. Many cache plugins exclude them on their own, but check the settings.
How do I make WordPress images lighter?
Upload images at the size they appear on the widest screen and in WebP format, which WordPress has accepted since version 5.8. According to the WordPress team, WebP files are on average about 30% smaller than JPEG and PNG. For images already in the library, use one optimization plugin, such as EWWW Image Optimizer or ShortPixel.
Do I need a lazy loading plugin?
No. Since version 5.5 WordPress adds loading="lazy" on its own to content images that have width and height set. Since version 6.3 WordPress marks the image most likely to be the LCP image with fetchpriority="high" and does not lazy load it. If the theme or page builder prints images with its own code the rule may not apply, so check the page source.
How do I find the plugin that slows WordPress down?
Install Query Monitor, open the slow page as an administrator and see which plugin or theme is behind the most and the slowest database queries and external requests. Deactivate Query Monitor after the check. Do not switch plugins off on the live site just to see the difference, and use a copy on a subdomain instead.
Is Cloudflare enough instead of a cache plugin?
No. By default Cloudflare caches files by extension, such as images, fonts, CSS and JS, but not HTML and JSON, so the page cache from the plugin is still needed. The WordPress documentation also says a CDN works best together with a cache plugin, and Cloudflare's free plan includes the CDN.
Sources
- web.dev, Web Vitals
- web.dev, Largest Contentful Paint (LCP)
- web.dev, Interaction to Next Paint (INP)
- web.dev, Cumulative Layout Shift (CLS)
- web.dev, Time to First Byte (TTFB)
- Google, About PageSpeed Insights
- Lighthouse, Variability
- WordPress, WordPress Optimization
- WordPress, Requirements
- WordPress, Update PHP
- WordPress, Site Health screen
- WordPress, Responsive Images
- WordPress, Plugin Uninstall Methods
- WordPress Core, Lazy-loading images in 5.5
- WordPress Core, WordPress 5.8 adds WebP support
- WordPress Core, Image performance enhancements in WordPress 6.3
- PHP, Supported Versions
- WooCommerce, Configuring caching plugins
- LiteSpeed, Troubleshooting Guide
- LiteSpeed, CSS/JS Issues
- WordPress.org plugins, LiteSpeed Cache, WP Super Cache, W3 Total Cache, WP Fastest Cache, Cache Enabler
- WordPress.org plugins, Modern Image Formats, EWWW Image Optimizer, ShortPixel Image Optimizer, Query Monitor
- Cloudflare, Cache overview
- Cloudflare, Default cache behavior
- Cloudflare, Purge everything