How to clear cache on WordPress?

Enabling server or client-side caching makes a WordPress site faster. It is the reason why the browser doesn’t show any changes when you make some changes in the design of the website or add a new widget. To fix this issue, you should clear the cache files. Let’s have a look at various methods of clearing cache on WP sites with or without a plugin.

Client side

Before going through the method of clearing cache files on a client side, let’s first understand/find out how client-side caching works. Well, if you configure the webserver/WordPress caching plugin to add expiry time to the static files such as stylesheet files, and JavaScript files, the browser will keep the files on the PC until the files expire. Instead of redownloading the same file, the browser will load the stylesheet or JS and apply the styles or execute the JS code present in the file. This process makes a WP site load faster.

Browsers let users clear all cached files with a click of a button. The option is available in the history section of the browser. When you click this option, the browser will prompt you to choose the files that you want the browser to remove. Once you select the files by clicking on checkboxes, click the OK/Submit button, and wait for the browser to delete the cache. When the browser has done this job, restart it and reload the page. This method will work only on WordPress sites that are not powered by server-side caching solutions.

Server side

Nginx fastcgi cache

A server-side caching module will store a copy of all pages or databases of your website. If you’re using Nginx FastCGI, you should delete the Nginx cache folder and reload Nginx by running the command service nginx reload. When you do so, Nginx will recreate the folder and will store a copy of the page in this folder each time a search bot or a visitor opens the page. If you’re using Redis database caching, you can delete the data stored by Redis in the system memory of the server with the FLUSHDB command.

Similarly, if you’re using a WP plugin such as WPSC, W3TC, etc, you can clear the cache generated by the plugin with the plugin’s built-in option.

Closing words: When you’re unable to see the recent changes you have made to WordPress, you should clear the cached files using one of the two methods we’ve shared above.

pramod
Pramod

Pramod is the founder of wptls. He has been using WordPress for more than nine years. He builds web applications, and writes about his experiences with various WP products on this site.

Leave a Reply

Your email address will not be published. Required fields are marked *