You all know how much I love caching, but what is it, and should you be using a caching plugin on your WordPress site?

What is caching?

In WordPress, caching is storing the output of one request, and using it to serve others. The most powerful, and probably the most often used, type is page caching. But, in order to understand that, you need to know the basics of how WordPress works. WordPress, by design, is a dynamic platform. What this means is that each time someone visits a page on your site, that page must be constructed by running PHP and querying the database. While this ensures the content is always in its newest form, it also means a lot of processing power is being wasted. A lot of posts aren’t changed that often, and dynamically generating the same page over and over again is just a waste of computing power. If your site is small, this isn’t much a problem. But, as your site grows, efficiency really starts to matter.

Page caching saves resources by storing the results of generating the page once. It then creates a static page, and serves that instead of regenerating the page for subsequent visits. Some caching plugins entirely bypass PHP and use .htaccess rules to boost performance as much as possible. Other plugins will still run PHP, but serve the cached page early in the WordPress load cycle, decreasing database queries, and still speeding up the site. If possible, use .htaccess rules, but PHP based caching plugins will work in nearly every hosting environment.


You’re probably thinking that this sounds amazing and should be built into WordPress. While caching does help with many problems, it also creates new ones. For example, pages are stored in a static form, which means that new comments will not be displayed until the cache is refreshed(unless you’re using something like Disqus). Most caching plugins will do this for you automatically, which means you don’t have to worry about that, but there are still other problems. Caching pages also means that server-generated objects will be the same for everyone(this especially affects member sites). This is the main reason that caching plugins to not cache pages for users who are logged in. Caching can also break some other aspects of your site, such as log-in pages, registration pages, etc.

Should you use a caching plugin?

This depends on a lot of things, but for the most part, yes. However, if you run a site that has most of your visitors logged in, or if your site receives a lot of comments, you might not see any benefit. In some cases, your site can become slower because constantly creating new cache files and removing old ones puts a lot of strain on the disk, especially non-SSDs. Also, if you’re on VPS or dedicated hosting, your site may be able to live without a caching plugin, and still load fast enough.

One thing you might not have known is that WordPress actually does have its own built-in form of object caching. Using a query monitor plugin, I’ve observed hit rates of over 90% even on wp-admin. However, the built in cache only lasts for one page load, and will be regenerated each time a user loads the page.

By the way, if you’re hosting WordPress by yourself, a caching plugin such as W3 Total Cache or WP Super Cache can serve pages even if you break the database, or even PHP. This has already saved me multiple times, and is the reason I usually enable cache pre-loading, so even pages that weren’t visited get cached.

Which plugin?

There are tons of WordPress plugins available, and each one has its own set of features. Each site has different needs, so please do some research before installing a caching plugin to find out which one will work best for you. Here are a few to get you started: