How to Clear WordPress Cache
Enabling caching is one of the most effective ways of boosting the performance of a WordPress website. Maintaining adequate security is probably a close second, but we definitely recommend enabling caching as one of your top priorities. But what does that mean exactly, what happens when you clear WordPress cache and is this something that you can do for yourself?
This guide is here to explain why you would want to clear WordPress cache on your WordPress sites, and it will also show you the various ways of purging or deleting the cache from inside and outside your WordPress installation.
The Idea Behind WordPress Caching
So, this is how a web page is loaded – somebody finds a link to your website. It could be through search engine results, somebody else’s website, social media or in an email. They click that link and are taken to your WordPress site. This generates an HTTPS request asking your web server to assemble and deliver all the files that your browser needs to load the website. The more images, files, and scripts it needs to throw together to build the site, the longer the HTTPS request takes to complete. If the person is patient while all this happens, they will soon be treated to a pristine view of your website.
Things are a little different when WordPress website caching is enabled. Here’s what that process looks like – someone finds a link to your website. They click that link and are taken to your WordPress site, this generates an HTTPS request that’s sent to your web server. The server can tell that there haven’t been any changes to the website content since the last time someone visited. The server sends a static copy of the website to the person’s browser window. Every visit to the site will be handled this way until either the page content changes or the cache expires and gets automatically purged.
So, as you can see, caching avoids making the server jump through hoops unnecessarily. When your business relies on capturing more leads via your website it’s essential to have quicker page loading times. These days, if people don’t get what they want within a couple of seconds then they will go elsewhere, so your page needs to load faster than that, and WordPress caching can help you achieve it. There are also times when you’re going to need a WordPress cache cleanup on your websites for other reasons though.
Reasons For Clearing the Cache on WordPress Websites
Website caching is used to give visitors to your site the best possible experience. A static saved copy of your site sent to each new visitor takes a lot less processing power to achieve, so they get the pages they want faster.
But that raises the question: why speed up content delivery to your site visitors if that content is nothing new?
The value of your website is that it brings worthwhile and compelling content to visitors, and if you aren’t updating your offerings on a regular basis then why should they bother coming back?
So, let’s take a look at some of the different ways that caching might mistakenly hinder new content delivery and why learning to do a WordPress cache cleanup manually is in your best interests.
Your website is really no different than any other piece of marketing collateral. Things like product details and contact information can change at a moment’s notice, and if you decide to rebrand then the website needs to change to reflect that. Your WordPress website is as dynamic and ever-changing as your business needs to be if it wants to remain successful.
Let’s say you’ve done all of that but you can’t see any of the changes on the website. Chances are that the caching mechanism hasn’t caught up with the changes yet.
Websites need to be regularly renewed with a steady procession of valuable and relevant content. Blog posts, white papers, and a million and one other pieces of digital real estate are constantly appearing to attract new visitors and keep old ones coming back. The more this happens, the more the search engines notice. Google, for one, is particularly enthusiastic about websites that regularly update and grow their content (as long as its high-quality stuff, that is).
But, if your web server is hanging on to the cached version of a particular page or it isn’t showing your new content to visitors, Google’s bots won’t even know that it’s there. This is an issue that sometimes occurs when your content is going into widgetized parts of the website.
Theme and Plugin Updates
One good reason for manually doing a WordPress cache cleanup is related to WordPress updates. In particular, every time there is a theme or plugin update, you need to do a WordPress cache cleanup to make sure that any changes you’ve made to the files, code or the way the website looks are reflected when the next HTTPS request comes along.
If you are using a managed WordPress hosting solution for your website, this is something to be aware of. If you migrate a website or database files change for any reason, chances are you are going to need to clear WordPress cache so that visitors aren’t bothered by error pages or an out of date version of your website.
Images Hosted Externally
Here’s another reason why a WordPress cache cleanup on your websites might be a good idea.
When using a WordPress plugin for image optimization, the server might carry on sending older uncompressed versions of them. To make sure that the server gets the images that the plugin has compressed, clear your cache following optimization.
When these changes to your website happen, your caching mechanisms need to pick up on the fact they have, and when they do, the WordPress cache will be cleared and the web server will handle the next HTTPS request using the updated content and deliver it to the browser.
Of course, that’s how things should work in practice, but the reality of how the software handles things is that it isn’t always smart enough to realize that an image with an identical file name but a different color product has been changed. It’s exactly this kind of thing that makes it essential for us to know how to do a WordPress cache cleanup on our websites.
How To Do a WordPress Cache Cleanup
The WordPress Codex has a page entitled “I Make Changes and Nothing Happens”. When people are new to WordPress, this is the kind of thing that you will often hear them say, because they don’t always remember that they need to click on “Update” or “Publish” after they’ve made their changes.
As we’ve seen there are lots of occasions when it is desirable to do a manual WordPress cache clear on a website so that the updates become visible.
Because caching can be used both inside and outside of WordPress there are several ways to purge its cache manually. If the website isn’t showing your changes and you know that it definitely isn’t a case of user error within WordPress here’s what to do.
How to Clear Your Browser Cache
You can only clear the browser cache of your own machine. Here’s how to do that in Chrome. Select the WordPress cache for your site using the Settings or History tabs. Once you’ve done that, go to the “Clear Browsing Data” section. This section will let you clear browsing data for cached files and images and delete the cache from every website in your browsing history. If you just want to clear your own website go back to Settings and go to Content Settings, click on ‘Cookies’ and expand ‘See all cookies and site data’. Perform the search of your website and clear it.
WordPress Cache Cleanup Using Cache Plugins
Let’s take a look at how to locate the WordPress cache cleanup option in case of various plugins usage.
WP Super Cache
This plugin is a lot less complicated. The downside to that is that you don’t have as much control over which cached data is cleared though. Despite that, it’s a breeze to use from these three locations – “Easy” and “Contents” tabs, as well as “Admin” toolbar.
W3 Total Cache
Find the Performance menu and look for the plugin “Settings”. Scroll down the page and make a note of the individual caching settings. When enabled, you’ll be given two choices to clear WordPress cache.
“Empty cache” is used if the settings stay the same, but you want to delete the cached data for that specific option. “Save Settings & Purge Caches” allows you to save a new caching configuration and purge the present cache at the same time. You can also purge all data and cached content from your website instantly with the admin toolbar “Performance” menu
Clearing WordPress Cache When You’re Using Managed WordPress Hosting
Caching is something that should also happen server-side. It’s a bit of a different way to do it from the usual WordPress website approach because you’re also looking at things like PHP caching, MySQL caching, object caching, and so on. Website caching only copies the content and files within your WordPress site. When WordPress cache cleaning doesn’t help, or if you just want to make sure that you covered all the bases, then clearing the server-side cache too is the way to go.
With managed WordPress hosting, various hosts frequently allow users to purge their own cache. Your web hosting company should be able to tell you whether you are allowed to purge a server-side cache, but even if they won’t let you access it directly, they may still be able to deal with the problem for you.
Clearing WordPress Cache On CDN Level
A content delivery network (CDN) adds an extra layer of caching to WordPress websites. CDNs have copies of websites all over the world in their data centers. This is so that they can send a version of your website that is geographically closest to someone. This means your visitors get to see your site more quickly than they otherwise would, which is exactly what you want.
To clear your CDN cache, you’ll need to login to its platform. Most popular platforms ( e.g. KeyCDN and CloudFlare ) provide user-friendly interface to initiate this process in few clicks.
Keycdn is a content delivery network with long history which is powering a huge number of sites across the web. To clear the cache, you need to login, click “Zones” and choose the zone you need. Use “Manage” drop down list to choose Purge by Tag / Purge Url / Purge.
You should login to your account, select the website of your interest and click “Caching” button. Choose “Purge Everything” or “Purge Individual Files, Purge By Tag” for Enterprise plan.
Clearing WordPress Cache Using the Command Line
Lastly, let’s take a look at what we need to do to clear WordPress cache via the command line. As it says here, this is so you can flush the object cache in your database. When you’re ready, run this in your WordPress command line:
$ wp cache flush
Success: The cache was flushed.
This will refresh all of the content you’ve added or the design elements that you’ve changed so that where they’ve been cached as fragments or objects your visitors will see the most up-to-date version, just as you intended.
Caching helps make your WordPress website work at its best, but sometimes you need to clear out all that cached information so that your visitors see your most recent content. Think of it as digital spring cleaning that can help make your business more successful. We hope that this guide helps you to keep your site in tiptop shape.
Oh no, sorry about that!
Let us know how we can do better below
Tell us how we can improve this post?