Managed WordPress Hosts provide caching features with an easy way to Purge WordPress cache. Have you ever spent hours updating your site, only to not have any changes reflect? Are you still seeing the old version? You may have tried the good old “reload” option – to no avail.
Don’t worry, your efforts aren’t all wasted! It’s most probably a cache problem.
So, how does this “cache” work? Why and how should you clear WordPress cache? We’ll answer this and explore your cache options in this Step-by-Step Guide.
Pro Tip: If you’re in a hurry for a solution, Head down to see How To Clear Cache in WordPress.
What is WordPress Cache?
We’ll begin by understanding how cache fundamentally works. I’ll be explaining this using a simple analogy – the humble pie.Your WordPress website is a bakery selling pies and cache is your delivery system. Click To Tweet
It’s Christmas time and the competition is fierce. The faster you deliver, the more repeat orders you’ll get. But then you notice, most of your orders are coming from the same place.
So what do you do? You don’t wait for a customer to call and order the pie – you bake them all beforehand and store them real nice. So when the next customer comes in, you can serve them immediately!
That’s how caching works. When any visitor lands on your site for the first time, their caching system saves a cached version of your site. This makes your pages load much faster the next time they visit.
But this comes with a pinch of salt. Going back to the Bakery analogy, what would you do if someone were to ask for a pie with lesser sugar? You’d have to start all over again. In the midst of all the orders, you might even forget about it. Similarly, when you make changes to your site, the caching system might still use the outdated cached version.
Now that we have a figurative understanding of cache, let’s delve a little into the technical side of things. What happens when you enable cache on WordPress websites?
How does Caching work in WordPress?
Here’s what happens when a user visits your site.
- A request is sent to your server to display the page.
- The server pulls the necessary data required.
- It sends this data as an HTML file (text file format) to the user’s browser.
- The browser processes the HTML file, converts it and displays it as a web page.
Now, if the user visits your site again, it would need to repeat this entire process again. There are two downsides to this.
A) It takes more time.
B) It uses more server resources.
To avoid this, we use a cache. A cache stores this HTML data in the browser. The next time the user visits the site, steps 1, 2 and 3 can be eliminated. The caching system will already have a copy stored and will simply process and display the cache files.
WordPress caching is used and implemented in two forms:
i. Client-side caching:
Client-side caching is also known as browser caching. In this type of cache, the static HTML pages are stored on the user’s local computer. Whenever a user visits the site, a copy is loaded from his computer. Thus, this approach is much faster.
ii. Server-side caching:
Server-side caching is used when you have a massive website with multiple databases. To increase efficiency, static pages are stored on the website server’s hard disk or RAM. Although this is not faster than browser caching, it is still faster than no caching.
Why do you need to clear the WordPress cache?
Normally, a new post or change in your content would trigger the caching system to delete outdated WordPress cache.
Yet, sometimes, your caching system may not realize that changes have been made and still show you the old, static, cached version. The conflict between the cached version and the updates may cause your site to break. Here are a few common situations where this may happen.
The simplest solution? Flush your WordPress Cache! Let’s take a look at how to clear the different types of cache.
Caution: The Immediate Aftermath of Clearing WordPress cache
- You’ll be logged out of most sites where you have an account
- You might have to re-enter your transaction details on some websites
- There’ll be a change in page loading speed
Steps to Clear WordPress Cache
1. How to Clear your Browser Cache
Your browser would have a caching system that stores a copy of all the sites you visit. So when you made changes on your site, it probably would not have caught it. Let’s take a look at how you can clear your cache on the three most popular browsers – Google Chrome, Firefox, and Safari.
Steps to clear your cache on Google Chrome
There are two easy ways to do this.
- Settings (3 dots) > More Tools > Clear Browsing Data
- Settings (3 dots) > Settings > Advanced > Clear Browsing Data > Select the cached data to clear > Clear data.
Steps to clear your cache on Firefox
Hamburger-looking Menu Button > Preferences > Privacy and Security > Navigate to Cookies and Site Data > Clear Data > Select cached data to clear
Steps to clear your cache on Safari
Safari Menu > Preferences > Privacy > Manage Site Data > Remove All
2. How to Clear your Server Cache
Your web hosting server would have saved a cached version of your site files. Different WordPress hosts have different steps to clear your cache. For example, WP Engine provides a caching solution that is accessible from the WordPress Admin dashboard. Kinsta, on the other hand, has its own caching plugin. Siteground gives users the option to clear cache through their cPanel.
To clear your server cache, it is best to get in touch with your WordPress Host directly or look at their Help/Support docs.
3. How to clear Cache in WordPress
You must have employed a caching plugin to speed up your WordPress website. The plugin essentially provides a cached version of your site to visitors browsers. While this is intended to help your site load faster, outdated cache content can build up. If you’re using a caching plugin provided by your web host, you’ll need to Purge the WordPress cache according to their procedure. Managed WordPress Hosts provide caching features with an easy way to clear your website’s cache.
If you’re using an external plugin, here’s how to clear your WP cache.
- Clear WordPress Cache with WP Super Cache Plugin from WordPress Dashboard
WP Admin Dashboard > WP Super Cache > WP Super Cache Settings page > Delete Cache
Under the “Advanced” tab, you have the option to clear cache automatically or at regular intervals.
- Clear WordPress Cache with W3 Total Cache Plugin from WordPress Dashboard
WP Admin Dashboard > Performance > W3 Total Cache Dashboard > Empty All Caches
4. Additional methods of purging cache
- Clearing Cache on your Reverse Proxy system
The following image from Cloudflare accurately depicts how a reverse proxy system works.
When a user requests access to a page, the proxy system acts as a middleman between the request and the servers. This system is used to restrict access to certain content or protect the identity of the user. For example, it is used by schools to restrict access to adult websites, Facebook, etc.
You can use the Proxy Cache Purge to purge the cache saved by your reverse proxy system. It detects website updates or changes and requests the proxy system to delete the cache.
- Clear Object Cache using WP-CLI
WordPress processes involve hundreds of requests made to the database. Object Cache is essentially the caching of queries made to the database. This can help ease the load on your database and increase its efficiency.
WP CLI stands for WordPress Command Line Interface. It is a textual interface that can communicate with your computer. You can use it to give instructions to execute programs such as updates, backup of your database, etc.
Here’s how you can use it to clear your Object Cache:
- Log into your WordPress website through SSH.
- Find the directory where your wp-config file is stored. It will mostly be in your public_html file.
- Add this code:
[master_rvjfwygaxt] : public_html$ wp cache flush Success: The cache was flushed. [master_rvjfwygaxt] : public_html$
Once you are done clearing your WordPress cache by adopting any of these methods, reload your website. You will notice that your changes are reflecting perfectly. Sites that used to be unresponsive will now load perfectly and your browser will show the latest versions of the sites you’re visiting. This will decrease your site loading time and improve your overall site performance and WordPress speed. You can if your website is slow.
It is important to have caching enabled for your site and also regularly clear the WordPress cache manually. Using popular WordPress Cache Plugins like WP Super Cache, W3 Total cache and WP Fastest Cache, you can optimise your website performance and get the most out of your site!
However, you need to exercise caution when dealing with Cache in WordPress. A small mistake can break your site or you could delete some important files. In such a case, it is always better to have your site backed up. For WordPress sites, the best option is a plugin like BlogVault which uses a dedicated server for all processes. With no extra load on your site, the process is a breeze, and you can recover your site in seconds!
For more WordPress Tutorials and Guides,
check out our blog!