While not unique to WordPress, if you have a WordPress website, you have probably heard of caching or browser caching, and been told a few times to “clear your cache.” (Note, this is different from clearing your CASH, which is not usually a good idea).
Caching in a Nutshell
There are a few types of caching and it can get very technical and confusing! For the purpose of this article, we will focus mainly on client-side caching.
Caching is a method of storing some information about a website in your browser’s memory so the next time you come back to the same website, it will load faster because it “remembers” some things that were there the first time. A web browser will ask the server if the content (mostly images and scripts/code) has changed since it was last downloaded. If it hasn’t changed, the browser will use its locally cached copy, instead of retrieving the entire item.
If you have a WordPress website, there are many plugins available which will force caching of parts of your website, so that it will load faster for your website visitors. In addition, many web hosts cache websites on their servers. For websites that don’t change often, this is a great plan – it can boost your website’s performance. Note that the content (words) of your website are not usually cached – it is more code and design features.
While caching is an effective process, if you are working on a live browser and making changes to the CSS (design) code, you might not see your changes right away because the previous version of the code is cached. This can be maddening if you don’t recall the caching possibility, because you KNOW you are changing the code, but not seeing it on the live site.
Clearing Your Cache
You can try exiting Chrome to clear the cache. This will often solve the problem. You can set Chrome to automatically clear your cache whenever you leave the Chrome App (here’s how).
You can also clear the cache and cookies in the Chrome (or other browser) settings:
1.To get started, open the Chrome menu and select “Settings”.
2.Click the “Show advanced settings” link at the bottom of the Settings page.
3.Click the “Content settings” button under the Privacy header.
4.Under Cookies, select “Keep local data only until I quit my browser” and click “OK”. When you close Chrome, it will now automatically clear your cookies.
- On your computer, open Chrome.
- At the top right, click More .
- Click More tools Clear browsing data.
- At the top, choose a time range. To delete everything, select All time.
- Next to “Cookies and other site data” and “Cached images and files,” check the boxes.
- Click Clear data.
“Hard” Cache Trick – Learn this Secret!
Sometimes simply “refreshing/reloading” your web page does not clear the cache. In these cases, if you hold down the “Shift” key while hitting the “Refresh” button (on a Windows/PC, hold the Control key while refreshing) this will magically clear the browser cache more thoroughly.
If you have the Inspector open in Chrome, you can right-click on the Refresh/Reload button and see the reload/hard reload and clear cache and reload options.
There are times, especially if you have changed website hosting or servers, when none of the above steps work. In some cases, rebooting your computer may work. Your router can also hold a cache, so you may also need to reboot your router to fully clear the cache.
Your computer may also hold a type of cache, called a DNS cache (sometimes called a DNS resolver cache). This is a temporary database, maintained by a computer’s operating system, that contains records of all the recent visits and attempted visits to websites and other internet domains.
If the DNS cache is preventing you from seeing changes to a website, this requires “flushing” the cache on your computer.
To do this on a Mac, open the Terminal and type in this code:
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed
In Microsoft Windows, you can flush the local DNS cache using the Command Prompt and typing:
Caching on Phones
You phone browser also uses caching. Look for the Settings in your browser and find the Clear History and Website Data option. This does not always work. Sometimes turning off your phone is necessary.
It is a good idea to keep the concept of caching in the back of your mind when working with your website – or any content on the web – to avoid frustration and confusion.