If you work on WordPress websites, you’re probably tired of telling clients or team members to refresh their browsers to see the changes you just made. But when even that doesn’t work, it’s time to clear the cache.
This post will explain how caching works and when and how to clear cache for a WordPress site.
Before we talk about how to clear cache, we need to review the different types of cache for WordPress sites. If you’re already a cache connoisseur, feel free to jump ahead to the next section.
Caching is a technique to improve your website’s performance. When your server receives a request for a page from a browser, it has to return with all the HTML, CSS, scripts, and images needed to load the page. A cache is a temporary copy of some of your website’s static elements that can help render a page without having to look it up.
The three main types of cache for WordPress sites are:
- Browser Cache. This store files locally on a visitor’s computer so pages will load faster. When you do a hard refresh (shift plus refresh), you’re telling the browser to clear the local cache when loading a page.
- Server Cache. Server cache limits the number of requests your server has to handle at once. For example, it can serve up a cached copy instead of looking up a stylesheet.
- CDN Caching. A CDN or content delivery network caches parts of your website on servers at data centers across the globe. The server physically closest to a website visitor will serve up any cached content, so your server only has to handle the uncached requests.
When we talk about clearing cache for WordPress, we’re looking at how to clear your server and CDN caching.
When to Clear Cache on Your Site
In most cases, your server or CDN will automatically update cached files on a set timeframe. For example, you might have a setting to check for new files after 48 hours. Sometimes you can’t wait until the next time the cache will be refreshed.
The most common reasons you’ll need to clear cache in WordPress are:
- Adding New Content or Updating Existing Content. When you make revisions to your site content, you might have to clear the cache to see the updates on your site.
- Clearing cache should be a standard part of your troubleshooting protocol. You know how IT people tell you to try turning your computer off and back on when you get an error? Clearing cache is the go-to first-level troubleshooting step because it often solves content or layout problems.
- Modifying Design. You’ll want to clear your cache when you change your design, especially if you modify a CSS file. CSS files are often cached by default.
- Updating Plugins. If you update a plugin or change the settings in a plugin, it’s a good idea to clear your cache. Plugins generate CSS and scripts. You might need to clear the cache to see any changes reflected on your live site.
How to Clear Cache in WordPress
The method you use to clear your cache will depend on how your site caching is set up. If you use a caching or optimization plugin, follow the instructions from your plugin developer.
If, instead, you opted for the simplicity of caching through a managed WordPress hosting service, you’ll follow the instructions from your hosting provider. Let’s look at how easy Pressable makes it to clear your cache and manage your cache settings.
Pressable’s Caching Options
Pressable offers three types of caching:
- Page and Query Caching
- Static Asset Caching (CDN)
- OPCache (PHP Code)
Page and Query Caching.
Page caching and database query caching utilizes WordPress’ Object Cache. By default, page and database query caching is turned on. You can manually exclude certain pages.
Static Asset Caching (CDN).
All Pressable plans include our global CDN for faster websites. Pressable’s CDN automatically caches the following types of files:
The default cache time for CDN files is seven days. So you’ll need to purge the CDN if you update any of these static assets. One of the most common reasons you’d need to do this is when you change the background image of a hero section. The CDN will serve up the old image for days after you’ve made the change if you don’t clear the CDN cache.
OPCache (PHP Code)
OPCache stores a precompiled script bytecode in the memory. Utilizing this caching reduces server load in future calls for a PHP file by having it ready to go.
How to Clear Cache in Pressable
You can clear and manage caching from your Pressable dashboard or our Pressable plugin.
From your dashboard, select the site you want to clear the cache for and click on performance. From there, you can clear the CDN and object cache.
For more advanced control of your cache or the ability to manage it from your WordPress admin, you’ll need to download and install our cache management plugin. Follow these instructions for how to install and use the plugin.
Another Way to Make WordPress Faster and Easier
Pressable’s caching is just one example of why hosting with us is best for WordPress. We make things simple and ensure your site loads fast. Want to take the platform for a spin yourself? Check out our free MyPressable Playground.
Zach has 12+ years of experience with WordPress, from creating and maintaining client sites, to providing support and developing documentation. A knack for problem-solving and providing solutions led Zach to pursue a job with Automattic providing customer support in 2015 working with WooCommerce support, and now Zach has recently joined our team here at Pressable. Outside of work, Zach enjoys spending time with his family, playing and watching sports, and working on projects around the house.