What is caching?
Caching is extremely important when it comes to WordPress website speed.
Caching stores frequently accessed data from your site in a temporary location on storage or in the memory for quick access.
That means caching can significantly improve a WordPress website’s loading times.
Caching and WordPress
Since WordPress is a dynamic PHP application, it frequently fetches information from your database and runs various processes whenever a visitor accesses your website.
If you have a lot of users loading your website simultaneously, this can slow it down.
Caching helps speed up your website by storing static information on disk to prevent generating this data every time the page is opened.
The cached version is created the first time a specific page is visited, and then that information is served to each subsequent visitor.
Think of the cached page as almost a static page your visitor sees. Static pages always load much faster than dynamic ones pulling from a database on each load.
Another benefit of caching is that it reduces the strain your website puts on your hosting account and it allows you to utilize more resources on your account.
Since it also speeds up websites, it improves user experience, drives more traffic through organic search (Google gives an SEO boost to faster websites) and helps you increase engagement and time spent on your website.
Caching plugins
Now that you understand what caching is and how it helps improve your website speed – let’s cover two of the most popular WordPress caching plugins.
W3 Total Cache
W3 Total Cache is one of the oldest and most popular WordPress caching plugins. It has an extensive set of options available to correctly set up WordPress cache, such as optimized progressive rendering, gzip compression, restricted minification support, CDN support, AMP support, page cache and object cache.
It can be a bit complicated for beginners due to the number of options it provides, but you can take time and fiddle with the setup since it’s a free plugin.
WP Super Cache
WP Super Cache is another extremely popular caching plugin for WordPress and is developed by the WordPress parent company – Automattic. It currently has over 2 million active installations with a 4.5 star rating.
WP Super Cache gives you an extensive set of caching settings such as page cache, advanced cache preload, gzip compression, cache pre-loading, CDN support and garbage collection.
It’s beginner-friendly and the settings are less intimidating for beginners, which is the reason it’s our recommended caching plugin for your WordPress website.
How to set up WP Super Cache
Login to your WordPress dashboard and head to Plugins > Add New option. Use the search field at the top-right corner and search for WP Super Cache, and click the Install Now button to install the plugin:
Click the Activate button to activate the plugin:
Easy setup
If you don’t want to customize the caching options, simply head to Settings > WP Super Cache > Easy tab and select the Caching On option.
This will enable simple caching for you, and you don’t need to adjust anything.
Feel free to use the Cache Tester option on the Easy tab to ensure that caching was correctly activated:
Advanced setup
Head to the Advanced tab in Settings > WP Super Cache to customize the caching options:
Here are our recommended settings that should be enabled:
Caching – enables the caching option.
Cache delivery method – select Simple mode. Expert mode is for advanced users that are comfortable with editing PHP files and understand Apache’s mod_rewrite.
Cache Restrictions – Set to Disable caching for logged in visitors. option so your regular visitors won’t see cached pages.
Don’t cache pages with GET parameters. (?x=y at the end of a url) – disable caching for pages that are different for each user (sales pages, ad campaigns, etc.).
Compress pages so they’re served more quickly to visitors – This is related to the GZIP compression.
Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated –displays the cached page during the generation of a new file.
304 not modified browser caching. Indicate when a page has not been modified since it was last requested. – prevents updating the cache on tag pages (to save server resources).
Make known users anonymous so they’re served supercached static files – make sure that all pages are cached for everyone (to counter the previous “don’t cache for known users” setting).
Enable dynamic caching – activates caching for dynamic content such as visitor count, ads, Amazon’s recommendations, and so on.
Mobile device support. (External plugin or theme required. See the FAQ for further details.) – this setting caches mobile pages if you’re using a mobile plugin such as WPtouch, or a mobile theme.
Remove UTF8/blog charset support from .htaccess file. Only necessary if you see odd characters or punctuation looks incorrect. Requires rewrite rules update – enable this option if you see weird characters on your website. If not, feel free to disable this option.
Clear all cache files when a post or page is published or updated – this option will update your blogroll on the homepage each time you publish a new post.
Extra homepage checks. (Very occasionally stops homepage caching) – this option updates blogroll and dynamic content on your homepage.
Only refresh current page when comments made – if you have a lot of comments on your posts, enable this option to only refresh cache for the specific page instead of clearing the entire cache.
Late init. Display cached files after WordPress has loaded – this option makes sure the content stays dynamic and fixes the “super cache dynamic page detected but late init not set” error.
Cache location – leave as is.
Cache Timeout – set to 3600 if you have regular traffic; 1800 is advised for high traffic websites. This setting controls how often cached pages expire, and you don’t want to set it too low.
Accepted filenames & rejected URIs – define pages that shouldn’t be cached. You should use this to exclude shop pages or pages that are updated frequently.
Examples:
- /shop/
- /shop/confirm-order/
- /shop/checkout/
- /shop/account/
- /shop/cart/
Rejected user agents – stop user agents from seeing cached pages. Most often, you want to use this for search engines like Googlebot and Bingbot.
Lock down – this option prepares your server for an anticipated spike in traffic and helps save server resources and prevent your site from crashing. When lock down is enabled, new comments on posts/pages won’t refresh the cached static files.
Fix configuration – this setting resets the default WP Super Cache settings.
Clearing cache
If required, you can clear the cache on your website via Settings > WP Super Cache > Contents tab by clicking on the Delete Cache button: