How Does WordPress Caching Work?

by

7-layers of Security for Your WordPress Site

Your website needs the most comprehensive security to protect it from the constant attacks it faces everyday.

how does wordpress cache work

The goal of every WordPress performance plugin is to reduce the time it takes to deliver a page to visitors. One of the main ways to achieve this is by storing a copy of each page. This is known as “Page Caching“.

On a typical unoptimized WordPress website, average page loading times can be around 3 to 5 seconds. By delivering static pages and following recommended optimization practices, page loading times can be reduced to between 0.5 seconds and 1 second.

benefits of reducing page loading times
WP Rocket explains the benefit of reducing page loading times to one second.

Each time someone visits a page on a WordPress website that does not use page caching, the server needs to:

  1. Load all WordPress core files
  2. Retrieve content stored in multiple tables from the website’s MySQL database
  3. Deliver this content to the visitor

This process can be quite intensive so it can take a while for the page to be delivered to the user. The process also has to be repeated every single time someone loads the page. Rather than go through this process every single time, a WordPress caching plugin will process a page once and generate an identical copy of it.

A cached page will be created for each page on your website and when someone visits your website, they will be delivered the faster “Cached” version of each page. Most WordPress caching plugins also support Content Delivery Networks (CDNs) to allow you to store your cached pages in data centres around the world. This reduces server response time further for visitors and helps your website handle traffic spikes better.

Clear Website Cache After Every Update

Cached HTML pages will become out of date if they are not regenerated after website updates. In order to update the cached version of a page, you need to delete the existing cached file.

The button to delete the existing cached version of a page is usually entitled “Delete Cache” or “Clear Cache“. The cache can be cleared on a page by page basis, but the option to “Clear All Cache” is preferred in most situations.

Clear All Cache Button
The “Clear All Cache” button in WP Fastest Cache.

WordPress caching plugins will generate a new static copy of a page if none exists already. By default, this is processed the next time a visitor requests a page, though page cache can be preloaded if you wish.

Whenever you update a blog post or page on your website, your website’s caching plugin will update the corresponding static HTML page so that it remains up to date. Unfortunately, cached pages are not updated when you perform other updates.

It is therefore important to manually clear all cache after making a major change to your website such as changing your website design or activating or deactivating a WordPress plugin. If you get into the habit of doing this, your cached pages will always be up to date.

Page Caching is One Piece of the Website Optimisation Puzzle

Page caching is one of the most effective techniques to reduce page loading times, but it does not guarantee a fast website. Your pages will still load slowly if you do not follow recommended optimization practices such as image optimisation.

EWWW Image Optimizer
Image optimisation WordPress plugins such as EWWW Image Optimizer can greatly reduce the size of images.

As I showed in my article “The Best WordPress Caching Plugins For Improving Website Speed“, modern WordPress caching plugins offer more than just page caching. They now include additional optimization tools such as database optimisation, deferring parsing of Javascript and removing unused CSS. These extra features can be incredibly useful and can save you from having to install additional optimisation WordPress plugins, though be aware that dedicated solutions can sometimes give you better results.

For example, WP-Optimize offers more database cleanup tools than WordPress caching plugins do. On my own website, I have also found Autoptimize to be a better solution for aggregating and minifying Javascript, CSS, and HTML.

Ultimately, the goal is to create a fast website. WordPress caching plugins should be at the center of every good website optimization setup, but be sure to use other performance plugins to improve page speed further.

Website Caching Issues That May Arise

WordPress optimisation techniques will help make your website faster, though be aware that some minor problems and configuration issues can arise when you use a WordPress caching plugin.

If you encounter any major problem, the first step is to undo the last setting you changed. Major issues can be resolved by resetting the caching plugin to default settings or deactivating the plugin altogether.

ProblemSolution
Page caching can cause your website design or content to be out of date.Clear page cache
Non-essential Javascript files can be loaded later to improve page speed, though this can cause problems with contact forms and other content. Exclude important files and pages from deferring
Browser caching allows browsers to store page content such as HTML, CSS, Javascript and images. This saves users from having to download the content again, however, stored content can become outdated.Define an expiration date for all content
Some minor issues may arise when using WordPress caching plugins.

The Pros & Cons of Web Hosting Page Caching

Some website hosting companies offer website caching at a server level, which means that no WordPress caching plugin is necessary. This is a great option for many website owners as it simplifies the process of delivering fast-loading pages.

Be aware that if a hosting company offers website caching, they may not allow WordPress caching plugins to be installed on your website as it may cause conflicts.

Tuned to PerfectionThe web host can configure page caching so that it works in harmony with their server
SimplicityNo WordPress caching plugin has to be configured when the hosting company handles everything for you
The pros of web host page caching.

Should you use a WordPress caching plugin if your web host offers page caching? That depends.

For beginners, letting your hosting company handle page caching is a simple and effective way of improving page speed. For technical users, however, passing full control of page caching to your hosting company could be problematic as you are not able to customise settings exactly how you need.

Limited CustomisationFew caching tweaks and customisation options may be available
TroubleshootingIt can be difficult to troubleshoot problems and optimise performance exactly how you want
“One Click” page caching setups may frustrate advanced users.

I encourage you to speak to your hosting company about your website setup. This will help you make an informed decision about which caching method to use.

Kinsta
Kinsta is a managed WordPress hosting company that manages caching for customers.

Page Caching With WooCommerce

Page caching is primarily designed for static content that doesn’t change, so it is important not to cache dynamic content.

On a WooCommerce online store, dynamic pages such as the shopping cart, checkout and account area, should not be cached. Widgets that show shopping cart and order information should be excluded too. This will ensure that customers do not experience any issues with orders.

To read more about configuring caching plugins with WooCommerce, please read the official WooCommerce documentation page “Configuring Caching Plugins“.

Final Thoughts

I hope you now have a better understanding of how page caching works and how effective it can be in reducing page loading times on a WordPress website.

Please check out my guide on “The Best WordPress Caching Plugins For Improving Website Speed” for a comprehensive look at the best WordPress caching solutions available today.

Good luck.

Kevin

Category:

You may also like


ManageWP vs MainWP: A Head-To-Head Comparison
ManageWP vs MainWP: A Head-To-Head Comparison

When it comes to website maintenance, efficiency isn’t just an option; it’s an essential. Without diligent management, your website is exposed to numerous risks.  The user experience could degrade, you…

How can we help you?

If you’re worried that your website has been hacked, MalCare can help you quickly fix the issue and secure your site to prevent future hacks.

My site is hacked – Help me clean it

Clean your site with MalCare’s AntiVirus solution within minutes. It will remove all malware from your complete site. Guaranteed.

Secure my WordPress Site from hackers

MalCare’s 7-Layer Security Offers Complete Protection for Your Website. 300,000+ Websites Trust MalCare for Total Defence from Attacks.