WordPress caching: what you need to know

Reudiger Dalchow
Published: 23 September 2022
Share:

Optimising your WordPress site for performance can be done in a variety of ways, but few are as important as implementing caching for your site.

Through caching, a lot of the heavier processes and queries that WordPress runs on each page load can be reduced significantly or outright bypassed thanks to temporary storage. So your sites can load as quickly and efficiently as possible and improve your Google CWV (Core Web Vitals).

This can help improve usability and ensure your site experience is the best it can possibly be.

We’ll go over the fundamentals of caching in regard to WordPress in this guide, how caching can be implemented and why you should consider using our inbuilt caching solution, StackCache on our WordPress optimised hosting platform.

Why do I need my WordPress site to cache?

WordPress, at its core, runs on PHP code compilation and back-and-forth query checks within your site’s database. For example, if you want to load your WordPress site’s homepage, the following happens:

  • WordPress loads and checks wp-config.php
  • It sets up any default constants set in this file
  • It then connects to the database, and begin querying for content
  • Active plugins are loaded, as well as the pluggable.php file
  • The site then loads any defined rewrite rules
  • The site’s theme is loaded, and the corresponding functions.php file
  • Once all this information is gathered, WordPress parses all the data for the requested page
  • It then fetches the page or post contents from the database
  • Finally, it loads the site template and displays the page as it should appear with all data

The above generally occurs within the space of seconds.

However, by implementing caching, many internal queries can be stored locally, which can bypass the need to dive into the database and files. The cached content will be loaded instead, vastly increasing your loading speed and site’s performance.
 

What do WP cache plugins do, and how do they help with the website’s performance?
 

WordPress caching plugins come in all shapes and sizes. Most generally handle static HTML caching to reduce the amount of processing required per load time.

Most of these will store the cached content locally in a cache folder, a majority of which are found in the wp-content folder. These files are then checked per site load and prioritised in loading over the core files of the site to cut down time and allow for faster speeds.

Some provide additional minification and compression functions for your CSS and scripts to allow for quicker load times.

They may also provide tools that allow for you to prioritise core files over JavaScript, which can be quite slow to load. This will allow your site to load what's essential to get the site to display much faster, reducing your TTFB (Time To First Byte) and load times overall.

What is the advantage of caching with your hosting and not as a plugin?
 

A plugin alone will naturally have limitations. Even with the plugin locally storing processes to avoid them being re-run, where these files are stored can still lead to slowdown in the long run.

Anyone connecting to the site still has to connect to the webserver, so if you’re in Australia and your site files are stored in the UK, it’s going to take some time for the site to load even when cached due to the amount of network hops and latency of the connection.

This is where 20i handles things differently. By integrating our caching solutions with our hosting’s built-in CDN.

We can store any cached site files directly on the CDN nodes. This means that anyone connecting to your sites will have the caching served directly from the nodes rather than the webserver. This vastly improves load times by completely bypassing having to reach our webservers directly and pushing your site’s performance further still.

How does the 20i WordPress cache solution work?

As caching is so important to the speed and performance of any WordPress site, we’ve taken it upon ourselves to develop our own caching plugin called StackCache.

StackCache acts as a normal WordPress caching feature, but integrates fully with our CDN and Edge Cache to allow you to fully control your site’s performance globally from a singular interface.

Not only this, StackCache compliments Edge Caching directly as it handles all the dynamic content of your site, while the Edge Cache handles all your static content to ensure that all resources get served faster for your visitors. You can specify how long to handle specific types of caching such as Image and JavaScript caching from either the Edge Caching area or StackCache itself.

On top of this, StackCache comes pre-built with our WordPress-optimised hosting, meaning that you can get your site loading faster as soon as it’s placed onto our hosting – no extra setup or additional installs required. And, if you want to get more advanced with your caching solution, you can set additional Cache-Control and Expires headers via a .htaccess file, and StackCache will follow these to store even more for your site.

As you can see, caching can have a major impact on your site’s performance. With our built-in Edge Caching and StackCache solution, our hosting works with you to provide you easy access and control of your site’s caching, allowing you to push the best speeds possible out of your sites.