Caching is the process of storing website’s static content to speed up the page loading speed. There are different locations to store the static content which includes HTML, CSS, JS and image files. Purging cache indicates deleting the currently stored content and refilling it with the latest updated content. This is an important activity whenever you update the content on your site. Otherwise, you, your visitors and search engines will not see the latest content without purging the cache. Though caching depends upon your WordPress setup, let’s explore the generic process of purging cache in WordPress site considering all options.
Storing Cached Content in WordPress
Since caching helps to speed up the content delivery process, it is being used at every stage before your content reaches the browser. After that, your web browser also caches static files so that they can be loaded from local storage next time instead of requesting from origin server. Here are the possible ways a WordPress site’s pages can be cached:
- Using caching plugins
- Other plugin and theme setting
- Server-side caching
- Caching from CDN
- Browser caching
- Cached pages in search engines
Whenever you change the page’s content or site settings, generally the cached content will be automatically purged. However, if you are not seeing the latest content in browser or search engine, you need to check the applicable areas for your site and delete the old cached content. After that, you can submit the new content to Google for indexing and showing it in search results.
1. Purging Caching Plugin’s Data
Nowadays, almost all WordPress site’s use caching plugin like WP Super Cache, W3 Total Cache, WP Rocket, FlyingPress, Autoptimize, etc. All these plugins do page caching to convert dynamic PHP pages and serve them as HTML pages to visitors.
- Most plugins offer a menu item to purge cache quickly. You may find the menu in top bar or in the plugin’s settings page. For example, go to “Settings > WP Super Cache” section and click on “Delete Cache” button to purge the cache for WP Super Cache plugin. Similarly, you can delete Autoptimize caching by selecting “Clear CSS/ JS Cache” from the top bar menu item.
- Some plugins use database to store the cached content while others store content in /wp-content/cache/ folder. You can delete the table/folder content to clear the cache and the plugin will regenerate the cache when users visit the pages.
- If you want to delete cache for a single page, check the available option in “Posts > All Posts” page in your admin panel. Normally, you will see an option when hovering over a post or page from the list. For example, you can hover over a post and click “Clear this cache” option to delete the cache only for that post with WP Rocket. Otherwise, you need to check the meta box offered by the plugin in post editor.
2. Check Plugin and Theme Settings
Besides caching plugins, your theme and other plugins may also offer optimization options. For example, popular GeneratePress theme offers a way to serve dynamic CSS as an external file or inline. Plugins like Spectra and GenerateBlocks also offer similar options to change the way of CSS insertion.
Many themes offer caching, combining and preloading CSS files option. In these cases, you should regenerate the CSS whenever changing the theme/plugin’s setting. After that, purge the cache of your caching plugin to fix broken layout due to outdated CSS.
3. Delete Server-Side Caching
Most shared hosting providers offer Varnish caching at server side. You need to login to your hosting account for purging the server cache if there are no front-end plugins available for that purpose. For example, SiteGround offers three levels of caching enabled through server-side as well as using SG Optimizer plugin. In addition to clearing SG Optimizer caching (click “Purge SG Cache” option in top bar), you need to login to your Site Tools section in SiteGround to purge the static NGINX cache, dynamic cache and object cache (Memcached).
4. Purge CDN Cache
Static cached content of plugins and theme will be still stored on your hosting server. CDN helps to speed up the delivery by storing the content in edge servers nearer to visitor’s location. In addition to content delivery, many CDN services like Cloudflare also allows you to cache files. In general, you should use caching at one place either using a plugin or through your CDN. If you are using CDN caching, make sure to delete that cache if you are not seeing the latest content. On Cloudflare, you can do this by clicking on “Purge Cache” link on your dashboard. Otherwise, you can go to “Caching > Configuration” section and purge the cache.
5. Clear Browser Cache
This is an essential action whenever you are testing or want to view the modified content immediately after updating. For clearing the browser’s cache, you can simply press “Control + Shift + Delete” keys in Windows or “Command + Shift + Delete” keys in macOS. Make sure you are logged out of admin panel to avoid losing unsaved content. This works on all popular browsers like Chrome, Firefox and Edge. On Mac Safari, go to “History > Clear History” menu to delete the cached content. Alternatively, you can use incognito or InPrivate browsing mode to test pages without caching.
Other aspect of browser cache is to change the lifespan of how long the browser needs to keep your cached data in the local storage. Browsers caches static file types .png/.jpg images and .css/.js files based on HTTP cache headers defined by the caching plugin. Generally, you will not see any plugin settings to change the HTTP headers from admin panel. However, you can check .htaccess file in your server’s root location to find the directives added by your caching plugin. Check out separate article on leveraging browser caching in WordPress.
6. Resubmitting Modified Pages in Search Engines
Sometimes you may notice Google and Bing shows the outdated content in the search results page. Clicking on the search result will take you to the page updated with latest content. This is due the fact that search engines also cache the content and it is not updated unless you inform them about the modifications. Unfortunately, you can’t purge the cache of search engines but you have the following options.
- Use modified date in XML Sitemap. This is an existing feature of popular SEO plugins like Yoast.
- Go to Google Search Console or Bing Webmaster Tools account and resubmit the modified pages using URL Inspection tool.
- Try IndexNow API for Bing and Yandex search engines. Plugins like RankMath offers this feature in free version or you can use separate Bing IndexNow plugin.
Final Words
As you can see the caching setup in WordPress is much more complicated with the content is cached at different levels. In most cases, you may want to purge the cache for one or few pages in your site. Plugins like WP Rocket will purge the cache of pages, homepage and archives whenever you update the content. Only purge entire site’s cache from plugin/CDN/hosting only when you have no options for deleting page level caching. You need to purge the cache of entire site for bigger activities like changing theme, CDN or hosting server. Otherwise, frequently purging site’s cache will slow down the site as the pages will be cached only when someone visits them again.
Leave a Reply
Your email is safe with us.