Transient Love: How to give WordPress Transients a try

Page caching is really good…

Most busy WordPress websites make use of some page caching plugin to ease processing load off servers and please site visitors with faster page loads. These WordPress caching plugins cache entire pages for serving up quickly.

…except when it isn’t

Sometimes, however, cached pages cannot be used. This is common for:

  • Membership sites, where user-specific content would make cached pages incorrect for most users.
  • Sites with rapidly updated page content, where cached pages would not keep up with visitors’ expectations.
  • Sites presenting unique content based on visitors’ location, browser, and other personal variables.

Partial page caching to the rescue

WordPress Transients - Suggests how code stored as transients have a limited lifespan
Data stored in WordPress transients are automatically removed after a specified time.

Even when the entire page should not be cached, there are usually certain parts of the page that rarely change and are still ripe for the benefits of caching. In this lesson, I will show you how to cache the global menu of your website — an element that rarely changes and is often found on every page of the site.

Learn to love transients

Rather than reinventing the wheel, we will use built-in WordPress functions for data blocks we call “transients.” Let’s get to work in the video below!

And there you have it — partial page caching.