Okay I am fairly new to WordPress. I am also computer dumb when it comes to tech talk. On my “Posts” page in my dashboard, it has “Purge from cache”. What exactly is this and what does it mean? If I happen to accidentally click on it, will it delete the whole post or my blog? No laughing!
Confused in WP world
It sounds like you’re using a caching plugin. So before I talk about “Purge Cache”, I’ll talk a bit about what a caching plugin even does.
How do caching plugins work?
If you’re using one, it’s probably because you’ve heard people say, “You need a caching plugin because it will make your site load faster!” But have you ever wondered why that’s the case?
WordPress sites are dynamic. That means they use a database, have complicated PHP scripts, and they’re always changing. All of your posts, comments, and other information are stored in this database. And every time you load the page, your blog has to figure out what page (or post) you’re trying to view, then pull that content out of the database to display it for you. It does that on every single page load. That’s a lot of work!
What a caching plugin does (usually) is generate static, HTML copies of your pages. So when the page gets viewed, it saves a copy of that page in a static form, the it displays that static HTML copy to your users. That way it doesn’t have to check the database every single time. It saves time and resources when loading pages. This can be why sometimes you make a change to one of your posts and you don’t see the changes instantly; it means you’re still viewing the old “copy” instead of a live version that gets retrieved from the database on the fly.
Still confused? Let’s use a metaphor! WOOHOO!
Say there’s an author of a book. That author has a finished, complete copy of the book. Now let’s say someone has decided to read that book in ebook format. In our metaphorical example, every time the reader turns the page, the author has to look up that page of the book and send the page contents to the reader. Manually. And they have to do that every single time for every single reader. They’re constantly flipping pages to send the content to the reader.
Wow, that sucks. So let’s introduce caching:
The author is fed up so they decide that instead of manually sending the page content, they’re just going to create a ton of copies and send each reader one of those copies. Now the author doesn’t have to do any work, because each reader has his or her own copy and they can view that static content. But that means if the author makes any changes to the book, the readers may not get them right away because they’re reading copies of the original.
What does “purge cache” do?
So now let’s talk about purging the cache. That simply means to delete the HTML “copies” of your pages. So if you purge the cache, it means the next time you view your blog, it will generate the page by pulling info from the database (the original method). Then, it will recopy the page again to create a new, static HTML copy.
So let’s go back to our metaphor. Say the author fixes a few typos in the book. Since the readers have their copies, they aren’t going to get the updates (at least not immediately). So to speed the process along, the author purges the cache. That means the author deletes all the copies that the readers had before, and then sends them new copies that have the corrections!
Purging the cache will not delete your blog!
Most caching plugins are set up to purge the cache after a certain amount of time (like once a day or once every few hours, or may even once a week). But if you make an edit to one of your posts and find that you can’t see the changes immediately but want them to be available, that would be a good reason to manually purge the cache.
Recommended caching plugins