Guides › HTML / PHP sites › Speed & performance

Cache Busting Static Files: Version Query Strings and Hashes

Force updates.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Slow website

Cache busting makes browsers download a new copy of a CSS, JavaScript or image file after you change it, while still caching it for a long time when it has not changed.

1Why it matters2Use a version number3Use file modification time4Use hashed file names5In WordPress6Check CDN handling7TestFixed? Test the site. If not, get help.
The steps in order. Work down the list and stop when the problem is solved.

Step 1: Why it matters

Illustration for Step 1: Why it matters

With long cache times, visitors keep seeing old files until the address changes.

Step 2: Use a version number

Illustration for Step 2: Use a version number

Add ?v=2 to file links. Change the number when you edit the file.

Step 3: Use file modification time

Illustration for Step 3: Use file modification time

In PHP use filemtime() to create the version automatically.

Step 4: Use hashed file names

Illustration for Step 4: Use hashed file names

Build tools create names like app.3f9a1c.js. The name changes only when content changes.

Step 5: In WordPress

Illustration for Step 5: In WordPress

Enqueue scripts and styles with a version argument.

Step 6: Check CDN handling

Illustration for Step 6: Check CDN handling

Some CDNs ignore query strings. Enable it or use hashes.

Step 7: Test

Illustration for Step 7: Test

Edit, reload and confirm the new file loads.

Still stuck?

If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-22.