IntermediateLesson 15 of 304 min read

Speed and performance

Measure and speed up a WordPress site: hosting, images, caching, plugins and fonts, with real page-weight measurements.

In this lesson you will

  • Measure page speed
  • Apply the biggest fixes first
  • Understand caching, CDN and compression
  • Avoid speed-plugin pile-ups

About 16 minutes

Every second counts

Karim’s site takes eight seconds to open on a phone. He has already lost many visitors by the time the first picture appears. Speed affects how people feel about a site, how long they stay and how well it does in search. It is also one of the few areas where small changes bring big results. This lesson teaches you to measure first and then to fix the biggest causes.

Measure before you change

Use free tools such as PageSpeed Insights, WebPageTest or the Lighthouse tab built into Chrome. Test the home page and a typical post, on mobile settings. Note the main results and the largest items on the page. Test again after each change so you know what helped. Results vary from run to run, so compare similar tests, and do not chase a perfect score.

What a page is made of, measured for real

A script fetched two pages from the test site and counted what each one loads. Run on a local test server, so times would mean nothing and are not shown; sizes and counts are what matters, and they are real:

home         HTML 148.7 KB | gzip 22.7 KB | stylesheets 5 | script files 2 | images 7
excel course HTML 40.5 KB | gzip 9.7 KB | stylesheets 5 | script files 1 | images 3
autoloaded options: 127, about 53 KB

The first page’s HTML alone is about 149 KB when sent as plain text, but only about 23 KB once compressed with gzip, a feature most hosts switch on. The pages also load several stylesheets and script files and a handful of images. Every file is another request, and every image is usually much heavier than the HTML. The last line counts the options WordPress loads on every request, a hint at why too many plugins slow a site: each can add data that is read every time.

The biggest fixes, in order

  1. Good hosting. A slow server cannot be fixed by plugins.
  2. Smaller images. Resize, compress and, where supported, use modern formats (lesson 5).
  3. Fewer plugins. Remove what you do not need.
  4. Caching. A page cache stores finished pages, so WordPress need not rebuild them for each visitor. Your host or one reputable plugin may provide it.
  5. A light theme. Heavy themes with many effects add weight.
  6. Lazy loading. Images below the screen load later. Modern WordPress does this by default for many images.
  7. A CDN. A network of servers that delivers files from a location close to each visitor.

Things that waste time

  • Installing several speed plugins that overlap.
  • Chasing a score of 100 when real visitors already see a quick page.
  • Heavy fonts: use one or two families and only the weights you need.
  • Auto-playing video and large sliders on the home page.
  • Third-party scripts such as many tracking and chat widgets.

Database and housekeeping

Over time WordPress stores post revisions, spam comments and old transients. A good host or a well-regarded plugin can tidy these. Take a backup first, and do not delete things you do not understand. Update PHP to a supported version through your host, since newer versions are usually faster and safer.

A simple speed budget

Item Target
Image per page Under about 200 KB each
Plugins Only those needed
Fonts One or two families
Third-party scripts As few as possible

These are rough guides, not rules. The real goal is that the page feels quick on a normal phone with an average connection.

Practice

Test your home page with PageSpeed Insights. Write down the three largest problems it lists. Fix the easiest one, such as compressing the biggest image, and test again. Record the before and after in a small table and decide what to do next.

Practice answer

Large images are the most common top item. After resizing one or two of them you will often see a clear improvement. If the server is slow even with a small page, the host may be the real limit.

Common mistake

Installing a speed plugin and never measuring. Without before and after tests you cannot tell whether it helped or only added another thing to maintain.

A one-hour speed tune-up

  1. Run PageSpeed Insights on the home page and save the top three issues.
  2. Compress and resize the largest images, then re-test.
  3. Remove two plugins you do not use.
  4. Check whether your host provides caching; turn on only one cache.
  5. Re-test and write down the new results next to the old ones.

An hour spent this way beats a weekend of random tweaking, because every step has a measured result. Repeat the routine every few months, and always after adding a big feature, since new tools can undo earlier gains.

Write the date and the scores in a notes file. Seeing a steady improvement over several months is far more motivating than a single number.

Check what you learned

Five quick questions. Pick an answer and you will see straight away whether it is right and why.

What should you do before changing speed settings?

  1. Delete all plugins
  2. Change the logo
  3. Measure the page
  4. Switch off backups

Then measure after each change.

What does a page cache do?

  1. Stores finished pages for faster delivery
  2. Hides images
  3. Changes the theme
  4. Resets passwords

WordPress need not rebuild each page.

What did the real measurement show about gzip?

  1. It deleted scripts
  2. It made the HTML much smaller
  3. It added images
  4. It slowed pages

About 149 KB became about 23 KB.

Which fix helps most on many sites?

  1. More sliders
  2. More fonts
  3. Auto-play video
  4. Smaller images

Images are usually the heaviest items.

What is a CDN?

  1. A kind of theme
  2. Servers that deliver files from near the visitor
  3. A form field
  4. A password tool

It shortens the distance data travels.

Summary

  • Measure, change one thing, measure again.
  • Hosting, images and fewer plugins matter most.
  • Caching and compression help a lot.
  • Aim for a quick feel, not a perfect score.

Next lesson

Next: users, roles and permissions in depth.

Questions

What is a good PageSpeed score?

Higher is better, but real visitor experience matters more. Compare your own before and after results.

Do I need a caching plugin?

Many hosts already cache. Check first, and use only one caching tool.

Why is my score different each time?

Tests vary with server load and network. Run it a few times and compare trends.

Progress is saved in this browser.