Site speed

How to make WordPress faster

WordPress speed is decided by the order of the work, not by the number of tricks: the host, and what your plugins do on every single request, outweigh everything else. The first fix is always free, which is switching off what you do not use.

  • Lesson 9 of 10
  • Intermediate
  • Free, no signup

Six moves, in order of leverage

  1. The host

    PHP version, an object cache being available, and time to first byte uncached

    1
  2. The theme

    how many queries build one page, and what it queues on every load

    2
  3. The plugins

    not how many, but what they do on a guest request

    3
  4. The cache

    page cache for the guest, object cache for the logged-in user and the dashboard

    4
  5. The images

    real dimensions, a modern format, and explicit sizes on every tag

    5
  6. The database

    the autoloaded options, read on every request and never seen

    6

This order is for a site whose visitors are mostly guests. If your traffic is mainly logged in, the object cache moves from step four to step two.

Last checked: Facts and tool names in this lesson are re-checked against their sources on this date.

Where to start, and why the order beats the list

A typical tutorial hands you twenty tasks and puts them in no particular order. The outcome is predictable: you do tasks fourteen through twenty because they are the easy ones, and the site stays exactly as slow. Six things actually carry weight, and their order is not arbitrary: the host, the theme, the plugins, the cache, the images, the database.

The order comes from cause and effect. If the server is slow, nothing in the layers above compensates for it; a page cache only delivers that same slow answer faster, and the first visitor still waits. If the theme runs three hundred queries per page, a cache plugin does nothing for a logged-in user, because that user page is not cached at all. The reverse does not hold: an unoptimised image on good hosting is still bad, but it only ruins that one page.

So the rule is simple. Fix a layer once the layer below it is no longer the culprit. And before all six, measure once; how to measure and how to read the report is opened in the lesson on measuring site speed, and it is not repeated here.

One boundary, stated up front. This order is written for a company site or a small shop. If most of your traffic is logged in, a membership site or a panel for instance, the page cache becomes nearly irrelevant and the object cache jumps from fourth place to second. The order is not a law of nature; it is a consequence of what your traffic looks like.

A black staircase whose widest bottom step glows red, then green, blue and two small white steps

How to judge a host without believing the sales page

No host sales page tells you its server is slow. So instead of reading that page, ask three things whose answers are either a number or a yes and no.

First, the PHP version, and whether you can change it yourself. WordPress own requirements page today recommends version 8.3 or greater, and states plainly that WordPress will still run on 7.4 but that this version has reached official end of life. If a host still serves 7.4 and gives you no way to upgrade, skip the other questions.

Second, whether an object cache is available. Redis or Memcached, it does not matter which; what matters is that it exists at all. It is the only layer that works for a logged-in user and for the WordPress dashboard itself, and most cheap hosting simply does not have it.

Third, the time to first byte on an uncached page. That number is the server signature, and everything else hides it, which is why you have to get around the cache. Add a meaningless parameter to the address so the cache layer is skipped, and take it three times:

curl -s -o /dev/null -w '%{time_starttransfer}s\n' "https://example.com/?cb=$RANDOM"

The number that comes back includes network distance, so compare it against another site over the same route rather than against a magic figure from the internet. We ran exactly this against our own front page and the first byte came in at about six hundredths of a second, with PHP genuinely building the page.

Shared hosting is not bad in itself. What is bad is a noisy neighbour, and no sales page reveals that; only taking the same number at different hours of the day does. If you are after a comparison of the services themselves, we wrote the criteria in our guide to choosing WordPress hosting, and the relationship between hosting and Google metrics in how hosting affects site speed; this lesson is about the test, not about the list.

Four things to ask, and four answers that say nothing

Hosting sheetBefore you buy

Ask this

  • which PHP version, and can I change it myself
  • do you have an object cache, Redis or Memcached
  • what are the real PHP memory and execution limits
  • where the backup lives and how I restore it myself

Answers that say nothing

  • high speed servers with NVMe disks
  • unlimited resources
  • high uptime, which is about availability and not speed
  • it is shared but performs like a dedicated server

The top column can be asked of support and answered in writing. The first-byte number cannot be asked for; you have to take it yourself and repeat it at different hours.

Plugins: the count is not the metric, what they do per request is

"Never run more than ten plugins" is a sentence everybody has heard and nobody can source. The very site you are reading runs 24 active plugins and we wrote 14 of them ourselves. The site is not slow, because most of those 24 do nothing at all on a guest request: no query, no file added to the page, no call to an outside service.

The right question is what each plugin adds to a plain request. The answer is visible and needs no guessing. This command lists every JavaScript file and every stylesheet a page loads:

curl -s "https://example.com/" | tr '\n' ' ' | grep -oE '(src|href)="[^"]+\.(js|css)[^"]*"' | grep -oE 'https?://[^"?]+' | sort -u

On an ordinary WordPress install every file path gives away its plugin folder, so the output is exactly the table of which plugin put what on this page. Run it against three different pages: the front page, a post, and the contact page. Whatever is needed on only one of them but loads on all three is the thing you are looking for.

Now a real example from us, and not a flattering one. The front page of this site carries jQuery version 3.7.1. Our theme queues no jQuery at all and our own JavaScript is three small files. That jQuery comes from one line in the security plugin: the captcha script is registered with a jquery dependency, and because our contact form has a captcha, WordPress dutifully ships the whole library on every page. Nobody chose that. It arrived with a feature we genuinely wanted.

And the first fix, the free one: switch off what you do not use. An agency that sells speed work says this because it is true, not because there is money in it. If you have not opened a plugin in six months, it is probably charging you on every page load. Keep one point in mind, because it is exactly what the last section is about: deactivating a plugin does not remove what it left behind in the database.

How much the cache changes, and why clearing it is not free

A page cache means WordPress builds the page once and the web server sends that finished file from then on. You can see the size of the difference on a real page. We took the front page of this site two ways, a minute apart and over the same network: when nginx hands over the cached file directly, the whole request takes about 0.07 seconds; when PHP rebuilds the same page, between 0.21 and 0.37 seconds.

That gap belongs to a site where all six items in this lesson are already done. On a site with a heavy theme and twenty active plugins the same gap is wider, and that is what makes a cache look like a miracle. It is not one; it is hiding the slowness, and for the visitor who arrives first at an uncached page it does not exist at all.

The layer most tutorials leave out is the object cache. A page cache is switched off for a logged-in user, so the dashboard, the cart and the account panel get nothing from it; the object cache works precisely there. If your dashboard is slow while your public pages are fast, that is the answer. The kinds of cache layers and the order a request falls through them is a separate lesson in this same track.

And now something we learned running our own servers and have never seen in a tutorial: clearing a cache is not free. Every page you clear has to be rebuilt by PHP, and cache plugins usually rebuild immediately what they just cleared. So the Clear All button launches a full crawl over every URL on the site, all of it through PHP, all of it at once. On a server hosting several sites, that is the move that takes the neighbours down with it. The rule we hold ourselves to is simple: clear only the page that actually changed.

The database: what is genuinely slow and what is folklore

On every request, before anything else, WordPress reads a batch of options from the database in one go. These are the autoloaded options, and nobody goes looking for them because they are invisible. WordPress own documentation for the add_option function is explicit: autoloading too many options can lead to performance problems, especially if the options are not frequently used.

On this site, today, 452 rows are read automatically and together they weigh 331 KB. 184 KB of that, more than half, belongs to a slider plugin that is not installed here. Its tables are gone, its files are gone, its only trace on disk is a zip of its add-ons. Its options are not gone, and they are read on every visit to every page.

Now the trap we fell into ourselves, which is the first-hand point of this lesson. The obvious command for looking at these options is wp option list --autoload=on, and on this site it reports 304 rows and about 116 KB. The real figure is 452 rows and 331 KB. The reason is written in the WordPress core source: since version 6.6 four different values, yes, on, auto and auto-on, all cause autoloading, and that command sees only the first two. Every one of those 184 KB of slider options is stored with the value auto, which is to say exactly in the blind spot the tool does not show.

So the correct measurement is this, and it only reads, it writes nothing:

wp eval 'global $wpdb; $q = $wpdb->get_row( "SELECT COUNT(*) c, SUM(LENGTH(option_value)) b FROM $wpdb->options WHERE autoload IN (\"yes\",\"on\",\"auto\",\"auto-on\")" ); echo $q->c, " rows, ", $q->b, " bytes\n";'

And to see where the weight sits, the same query with the top ten listed:

wp eval 'global $wpdb; foreach ( $wpdb->get_results( "SELECT option_name, LENGTH(option_value) b FROM $wpdb->options WHERE autoload IN (\"yes\",\"on\",\"auto\",\"auto-on\") ORDER BY b DESC LIMIT 10" ) as $o ) printf( "%8d  %s\n", $o->b, $o->option_name );'

The names that come back tell you who the culprit is, and what follows is human work rather than a script: search each name, work out what it belongs to, and delete only what you are certain no longer has a plugin behind it. Take a backup first. We have not done this on our own site yet, and that is exactly what makes the number first hand.

And the piece of folklore worth dropping: revisions. The posts table on this site holds 795 rows, of which 2 are revisions. Deleting them changes nothing measurable. On a site with five thousand posts each saved twenty times the story is different, but that site should be counted before it is cleaned. Any advice that tells you to delete revisions without counting is talking from memory rather than about your site.

The heaviest things read on every request

the four heaviest autoloaded options on rgb.ir, measured 2026-09-08
  1. 1the slider template store 127 KB its plugin is not installed
  2. 2the add-on list of the same slider 46 KB also not installed
  3. 3the URL rewrite rules 23 KB WordPress own, and needed
  4. 4the block stylesheet transient 22 KB temporary, yet autoloaded

The first two rows belong to a plugin that is not installed on this site. These numbers are one site and will differ on yours; the query itself is in the text so you can take your own.

The fast path, with AI

The usual way to find what should go is this: switch one plugin off, load the page, look, switch it back. For twenty plugins that is an afternoon, and it happens on the live site. The fast path replaces the trial with evidence: it puts the real list of what your pages load in front of a model and asks it to classify each item and, for whatever is never needed, to write the exact conditional code. It takes about a quarter of an hour, and what matters more than the speed is that the output can be checked.

  1. Take the asset list from three or four different page types, not from one. The front page, a post, the contact page, and the cart if you run a shop. The command is in the body of this lesson; keep each output separate, because the difference between them is exactly what the model needs to see.
  2. Next to each list write one line saying what that page does and what has to work on it. Without that line the model cannot tell "not needed" from "needed but invisible to me", and that single distinction is the difference between an optimisation and a broken form.
  3. Give the prompt below both pieces. This is judgment work, so the frontier class answers better; fetching dozens of URLs is a script job and not a model job, and handing that to a model only burns time and money. The current pick in each class is kept in our AI reference at /ai/, and no version number is written here, because it would be wrong within the year.
  4. Apply the output one item at a time, never in a batch. One removal, then open every page that could need that file, then the next removal. If you have nowhere to test that is not the live site, remove nothing; in that case the model output is a list to review, not a patch to run.

Copy-ready recipe

You are a WordPress performance engineer. Today your job is not to remove anything, it is to classify. Judge only from the data below and add nothing from memory.

The asset list of each page:
{paste the command output for each page here, under that page name}

What each page does and what has to work on it:
{front page: ...} {post: ...} {contact: the form and its captcha} {cart: ...}

Write four things:

1. Build a table with one row per file: the file name, which pages it appeared on, and your guess at which plugin or theme it belongs to. If the path does not make that clear, write unknown; do not guess.

2. Put each row in one of three groups: needed on every page, needed on some pages only, needed nowhere. For the second group, name the pages.

3. For the second and third groups, write the WordPress code that removes it conditionally. For every code block, say explicitly that I have to confirm the handle myself and that it cannot be inferred from the file name.

4. For each change, write exactly which pages and which features I must test after applying it to be sure nothing broke.

Rules: do not write any plugin, hook, function or handle name unless it is in the input or you say explicitly that it is a guess needing confirmation. Do not write any number about how much faster the site will get; this data does not produce one. If you do not recognise a file, say you do not know. If you conclude there is nothing to remove, say that; it is an acceptable answer.

Before you trust the output: Know two things before you run any of it. First, a wrong removal breaks things silently: nothing is logged anywhere, a button simply stops working or a form stops sending, and you find out three weeks later from a customer. The model does not know that your contact form is the only place that captcha is needed, because you did not write it in the input. Second, handles do not follow from file names. On this very site the captcha file is called turnstile.js and its registered handle is itsec-recaptcha-script; any code that guessed the name from the file path quietly does nothing at all, and you believe the removal happened.

AI in this kind of work

A language model is useful here, but not for the question most people ask. The bad question is "how do I speed up my WordPress site"; the answer is the same generic list that sits in a thousand other articles and it makes no decision about your site. The good question puts the real list of what your own pages load in front of it and asks it to classify. The difference is that in the second case the model works on your data, and in the first it builds a list from memory.

Tools that actually help

  • Claude A good fit for the classification job: it takes the asset lists of several pages and returns a table and conditional code instead of generic advice. Iran is on neither of Anthropic two supported-countries lists, so there is no official sign-up and no Iranian card is accepted.
  • Claude Code Its difference from a chat window is real: it runs on your own server, so it can open the theme file and read the actual handles from the code instead of guessing them from a file name. The tool installs for free but needs a Claude subscription or an Anthropic Console account, and Iran is not on the supported-countries list.
  • Gemini If you decide to hand over the asset lists of ten pages at once, it handles very long inputs well. Google own page says the Gemini web app runs in over 230 countries and territories, and Iran is not on that list.
  • ChatGPT Enough for the tidying and table-building part of the job. We make no claim about access from Iran, because OpenAI supported-countries page, like the rest of that domain, returns 403 to this server.

Where it backfires

Three risks, and the first is specific enough to this topic to deserve its own sentence: the model invents the script handle from the file name. It has seen the WordPress naming pattern and can produce something that looks right and does not exist, and code written with a wrong handle throws no error and does nothing at all. On this site the file turnstile.js is registered under the handle itsec-recaptcha-script, and no guess from the path ever reaches it. Anthropic itself calls a model stating something confidently without support a hallucination, and names this as the way to reduce it: force the model to quote only from the document you gave it. The second risk is about data: your site asset list is in practice a list of your plugins and their versions, and what happens to text you paste into a service depends on that service, your plan and your settings. Anthropic own page says that for its consumer products chats are used to improve the model if you choose to allow it, and it counts its commercial products separately. If you are working on a client site, read the page of whichever service you use once. The third risk is the old one: the model will confidently tell you to remove the plugin that is the only thing making your payment form work. Our position: the model may classify your list and propose code, and it may not decide what is unnecessary; only somebody who knows the site knows that.

Sources: Anthropic: reduce hallucinations Anthropic: is my data used for model training Anthropic: supported countries Google: where Gemini Apps are available

Where this advice stops

This lesson is written for a company site or a small shop on shared hosting or a VPS, and it has a few clear boundaries. First, its six-step order depends on the shape of your traffic; if most of your visitors are logged in, the page cache is nearly irrelevant and the whole order shifts. Second, a shop with tens of thousands of products, a multisite, or a site whose slowness comes from an external service called on every page, is a different problem, and we have no first-hand experience at that scale to put here. Third, there is no number on this page about how much faster these moves will make you, and its absence is deliberate; the figures in this lesson belong to one specific site and will differ on yours. And last, we do not name a best cache plugin, because the right answer depends on the host and on the shape of your traffic, and any list that does not say so is selling something.

From our own work

Two things made this lesson worth writing, both of them our own faults, and both measured on this site on 2026-09-08. First, the front page you have just come from carries seven JavaScript files and one of them is the whole jQuery library. Our theme queues no jQuery at all; it is one line in the security plugin registering the captcha script with a jquery dependency, and because our contact form has a captcha, the library goes out on every page. Second, 452 options are read automatically, weighing 331 KB together, and 184 KB of that belongs to a slider plugin that is not installed. What we learned from the second and had never seen in a tutorial is that the standard command lies: wp option list --autoload=on reports only 304 rows and 116 KB, because since version 6.6 the WordPress core counts four different values as autoloading and that command does not see two of them. All 184 KB sat exactly in that blind spot. We have fixed neither of these yet, and that is what keeps the numbers real.

Real follow-up questions

How many plugins is too many for WordPress?

There is no number, and anyone who gives you one did not read it anywhere. The site you are reading this on runs 24 active plugins and is not slow. The right measure is how many queries each plugin runs on a guest request and what file it adds to the page, which the asset list command in this lesson shows you.

Does cleaning revisions and the database make the site faster?

Count first, then decide. On our site only 2 of the 795 rows in the posts table are revisions, and deleting them changes nothing. What genuinely gets read on every request is the autoloaded options, and that is where we found 184 KB of rubbish, so go there rather than after the revisions.

My WordPress dashboard is slow but the site is fast for visitors, why?

Because the two go through different routes. Public pages come from the page cache and never reach PHP, while every dashboard page is built from scratch. So what you are seeing is the real speed of your server and your plugins with nothing in front of it, and the layer that helps on that side is the object cache, not the page cache.