We all like fast websites. Whether you are a reader or a webmaster or Google itself fast loading websites are our priority because it boosts the user experience, decreases the bounce rate and most importantly improves your site SEO. In recent years, most of the people know the fact that Google prefers to rank higher when page speed is better than the rest of similar pages (one of the primary SEO factors).
There are a couple of factors that decide how fast your page will load on visitor’s browsers. Among them caching is one of the biggest factors that can improve your page performance significantly. So if you want to optimize your website performance you should use caching for sure.
And if you have not enabled yet… you should.
In this article, you will know how enabling cache will impact your site? And on the other hand how cache can create some problems with your site? So how you should clear site cache using different methods on the WordPress website?
How Cache Works On Your Site When It’s Enabled?
This is a little complex scenario but when we break it down into partitions we can easily figure it out. There are different kinds of cache systems that can be applied on your site, we will see them one by one.
- Consider a visitor has clicked on a link to your site form either search engine or a 3rd party website.
- When he clicks on the link, the browser will send a quick request to your server requesting the page files.
- When the server receives the request it will send the response with HTTP/HTTPs depending on the activation of the SSL certificate.
- Now before the server responds to that request, it first checks whether there is any kind of updates on your site.
- If no > the server will send a static copy of the website to a visitor’s browser.
- If there is any update > the server will purge or clear the cache (temporary information) and send the fresh copy to the browser.
This image will help you understand how the complete procedure works with a simple presentation.
So, the advantage of using caching or temporary memory is that it improves the site loading time by sending the pre-stored data to the browser and save time + server resources.
One more advantage of using caching is the visitors will receive better user experience while surfing your pages because the page elements are already loaded properly hence no delay in deferred js or CSS.
Running a website you will surely understand that user experience matters a lot when you are trying to grow your business. Good user experience will decrease your site bounce rate, hence driving more engagements. More engagements can provide you more sales.
While they were being the positive sides of applying to cache on your site, sometimes depending on the situation you will need to clear your site cache. Let’s find out why you should purge your website cache from time to time.
Why Purge Cache On WordPress Sites?
Until now you know that we use website caching to provide optimal site performance + better user experience for the visitors, and that is important. Because user experience matters a lot when it comes to website bounce rate. The lesser the bounce rate more will be the engagement hence more sale.
However… there are times when you should clear your site cache too. For example, when you update your website contents or made some modifications to the design it’s recommended to clear your cache. It’s not a usual case that your server will keep sending the previous files from the cache memory, but sometimes it may send.
If so, your visitors are not going to see all those changes that you have made recently. People constantly search for new content on websites, if they are unable to see changes there is a chance you will lose your returning visitors.
This is the reason you should clear site cache from time to time either manually or automatically with the help of plugins.
That being said you should understand when you should clear your site cache as well. This can be varied depending on your site and your work on it. Still, I would like to mention a few moments when you should consider purging your site cache.
- Purge cache, if you have changed or customize your theme recently.
- Purge cache, if you have added some banners or new ads on your site.
- Purge cache, if you have published a new article a few minutes ago.
- Purge cache, if you have added a new image inside your content or uploaded an optimized version of the previous image.
- Purge cache, if you have installed/updated a new plugin.
- This is not a usual condition still you should purge the cache when you have updated/modified your site database.
Following the reasons for purging website cache, now you should figure out the ways to clear website cache. To be honest, there are a number of ways to clear cache using plugins, command codes, server cache manager, CDN cache manager, etc. Let’s see how the procedures work…
How to clear cache in a WordPress site?
As mentioned before, there are different types of cache clearing methods I would like to mention the “plugins way of purging cache”. Remember, the cache you are going to purge with WordPress plugins will clear the cache only inside the CMS. The cache that is assigned with the site from the server-side or CDN won’t get purged with plugin’s help.
#1. Clear Cache Using Your WordPress Caching Plugin
There are a couple of good caching plugins in the WordPress repository which you can install for free and setup with your site. (Remember, do not activate two caching plugins at the same time or plugin conflict can harm your website)
>> Clear cache with w3 total cache plugin
W3 total cache plugin is free to use and you can install it directly from the WP repository. First of all, install the plugin and activate it. Now go to your WordPress dashboard and find the settings of the plugin. You will see an option called “performance” where you can find all the settings related to the plugin.
Now from the “performance” menu, select the general settings. In the general settings, you will see the preview mode which you should enable first to detect if anything goes wrong during configuration.
Under the preview settings, you will see page cache where you can enable page cache. Keep the page cache method as “Disk Enhanced” and save the settings.
Near the save button you will see the empty cache option as well. Click on “empty cache” if you only want to clear the cache. If you want to change the settings + clear the cache of the plugin, click on “save changes and purge cache”.
You can purge your site cache directly from the dashboard using the plugin’s performance menu in the admin toolbar. Hover on performance and click on purge all cache.
>> Clear cache with the wp super cache plugin
If you are not using w3 total cache plugin there is another popular plugin called WP super cache plugin which you can use instead. The plugin is free and available in the repository. Install and activate the plugin to get the caching configurations.
Now find the “wp super cache” plugin configurations under “settings” of WordPress dashboard. It will appear as “WP super cache”. First of all, you will see the “on-off” settings for site cache. Make sure you have enabled it and update the plugin setting.
For more advanced settings, go to the advanced tab near the easy tab of the configuration dashboard. You can apply cache restriction, delivery methods, and set up cache locations under the advanced settings. As soon as the plugin is configured you will see a “delete cache” button on the WordPress toolbar. Each time you make some changes to your site prefer to click on delete cache once to purge website cache.
>> Clear cache with WP fastest cache plugin
The fastest cache plugin is a great competitor of w3 total cache. It is already popular and used by millions of people. The fastest cache plugin is free to install from the WP repository.
Like the W3 total cache plugin, you will see wp fastest cache option inside the plugin dashboard. Click on it to enable caching settings and other related configurations.
Under the plugin’s “setting” tab you will find the cache enable the option. There are a couple of other configurations as well which you can try with caching. After enabling the cache in the next tab (delete cache) you can clear site cache.
Similarly, as w3 total cache, you have the option to clear your WordPress’ cache using the “clear cache” option from the WordPress toolbar.
>> Clear cache with autoptimize plugin
Autoptimize is one of the easiest but equally efficient plugin when it comes to cache and website optimization. This plugin can boost your site performance to a higher standard when configured properly. So it is my personal favorite to optimize WordPress websites.
Purging caching with Autoptimize is easy and the plugin is free as well. So you can easily effort to try it out just by installing and activating it from the plugin’s directory.
Unlike other caching plugins you won’t have to enable caching with Autoptimize. Just configure the available settings and cache will be automatically applied according to the configurations.
Then go to the end of the plugin settings and click on “save changes and empty cache” to purge your site cache.
You can also clear the cache from the “autoptimize” menu of the WordPress toolbar like the previous plugins.
>> Clear cache with Litespeed caching plugin
Lightspeed plugin is an advanced caching plugin and hence you should be careful during the plugin configuration. There is a preview mode that checks whether your site is working fine or not after applying those configurations. So you should enable it to test those configurations before publishing the changes on site.
Though, the influence of the plugin to boost site performance is really good depending on your web server. It has various settings for different categories of cache like object cache, browser cache control, and advanced cache tracking system.
To enable cache you will need to activate global caching settings inside the plugin. Later you can try the additional caching to improve the website’s content delivery.
To clear cache with this plugin you need to use the “light speed” menu on the WordPress toolbar. From the menu, you can either clear all cache or lightspeed plugin cache or CSS/js cache, etc.
There are no direct options inside the plugin to clear the site cache. Still, the toolbar option is considered as an easier approach.
>> Clear cache with WP optimize plugin
WP optimize is actually a WordPress database optimization plugin, which takes care of your site database and keeps it neat and clear. Recently the caching system has been introduced in the plugin and it works very well so far.
WP optimize is a freemium plugin that means you can optimize the site database, apply cache with the free version. To apply image optimization and lazy load you will be required to go for the premium version.
Although, the caching system is quite good for WP optimize. The settings are really simple, even a newbie can set up this in one minute. You will have options like configuring cache lifespan, enable or disable cache for logged in/out users, separate cache files for mobile devices, etc.
Dynamic rules of caching can be applied to the URL and static file caching can be configured in a single step, which is very rare in other caching plugins.
Once page caching is enabled you will be able to clear website cache time to time using the purge cache button.
#2. How to Clear Cache Inside CDN
CDN works like an upper layer on your site which provides multiple advantages. It protects your site, delivers your site to wider range and increases the site performance.
More than these features CDN activates an additional caching layer on your site by sending content through a separate server which is much faster than your web hosting and distributed data centers all over the globe.
So, while using CDN you provide a faster site experience and lowest possible physical gap between your site and visitors. There are many 3rd party CDN that you can use with your WordPress site. I will select Cloudflare as an example.
Before setting up caching on Cloudflare and start clearing them from time to time you should connect your site with it. Once the DNS address points to Cloudflare and site is available through them you can activate caching using the “cache tab” inside the Cloudflare menu.
Remember Cloudflare can be controlled manually from the official site or using Cloudflare or lightspeed caching plugin. I prefer to use the official site instead.
Note: try to use as few plugins as possible to decrease site load.
Inside the Cloudflare dashboard pick your site of which you want to clear the cache. Go to the “caching tab” and it will give you two options.
- Custom purge
- Purge everything
With the “custom purge”, you can set advanced purging techniques such as URL purging, purge by hostname or purge by tags.
Click on “purge everything” if you simply want to purge the whole CDN cache for your site.
Sometimes if clearing cache on WordPress doesn’t reflect the changes in your site, clearing cache from Cloudflare or other applied CDN can fix the issue.
#3. How to Clear Cache On Your Server-Side
Caching at the server level is called server-side caching. This mainly includes various protocol caching on the server that is used for the WordPress site. Though it includes caching related to pages, database queries, etc… there is one cache we should purge on the server-side.
It’s called reverse proxy which is a type of additional server that retrieves elements on behalf of a client from the primary server. It should be cleared so that the client or browsers doesn’t get a static page over HTTP requests.
Some examples of such servers are Varnish, Nginx, etc.
In case, this type of caching is enabled on your server, you will need to clear the cache by requesting/using the purge cache tool provided by the web host.
Else, you can use WordPress plugin which will help you clear those caches. “Varnish/Nginx Proxy Caching” is a free, easy to use and effective plugin in this case.
Install the plugin and enable the cache, keep other settings as default. Save the settings and clear your cache. Once the plugin is activated it will automatically clear your server cache associated with the site.
Another helpful plugin is “proxy cache purge” plugin which does pretty much the same thing but there is an option which lets us mention the plugin here.
The “development mode” in the plugin settings help your site by providing the existing page to visitors even when the site is under construction. For that certain duration (under development) the plugin will skip clearing your server-side cache.
#4. Clear Cache Using the WordPress Command Line
The last option I want to include here is clearing the cache using the WordPress command line. The WordPress command line is very powerful, hence it can be used for all other tasks including clearing website cache.
This method of clearing cache is mainly used for purging object cache. Hence there is a caution that you should be careful while applying this because object cache can slow down your website performance for an indefinite amount of time. Nevertheless, here is the command that you will need to execute to apply object cache on WordPress.
# Flush cache.
$ wp cache flush
Success: The cache was flushed.
There are some global parameters that you can add with this code for advanced execution. You can find those parameters in this developer page.
Purging website cache is an important task for webmasters that take care of your site updates while delivering an improved site performance due to the cache.
This article features various ways that you can apply to clear the cache on WordPress websites. Hope this guide will be beneficial for you. If you have any doubt, let me know in the comment section below.