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:
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:
Or, if you’re on a sub-page or post, you can add the query string like this:
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 🔥