Raunak Hajela

@raunakhajela

WordPress changes not showing? Here’s how to fix it.

Share post:

If you are using WordPress, chances are that you are caching your web pages using a CDN and a caching plugin.

However, even after purging the cache, you may not be able to see the changes you made to your website.

You purge the cache, you refresh the page, and…nothing. Your changes aren’t showing up. 🤔

Don’t fret. There is a better way.

Let’s say you made some customizations to this page:

https://raunakhajela.com/

And you want to see those changes without having to purge the cache every time.

You can simply use a random query string to the end of your URL, like this:

https://raunakhajela.com/?x=1234

Or, if you’re on a sub-page or post, you can add the query string like this:

https://raunakhajela.com/blog/?color

Notice the question mark followed by a random variable x with a value of 1234. This variable can be anything like a, b, c, color, name, anime, and so on.

So, what is this magic 🪄 you ask?

Basically, your cache plugins and CDN cache all the website pages, and when you purge it only your cached pages are purged.

Most caching plugins exclude query parameters to ensure that the cache is not unnecessarily bloated and that each user receives the correct version of the page or resource.

The question mark followed by a random variable tells your caching plugin to fetch a new version of the page, bypassing the cache.

So, when you use these query parameters you are able to see your website changes 🔥

2 comments

  • Great observation! The approach mentioned here works like a charm for builders. However, when it comes to custom themes with versioning sepcified, things can get a bit tricky. Browsers tend to load specific versions of files, such as `main.css?v=1.2`, which might cause some issues event with above trick. But it won’t be much of an issue as we are moving with nocode builders in most cases 😀

Leave your comment