W3 Total Cache (W3TC)

W3 Total Cache (W3TC)

W3 Total Cache supports APCu and Memcached for multiple servers.

I really like the way it integrates with Nginx - simple and non-intrusive. It creates a file in nginx.conf www root that I must include in my custom nginx configuration.

W3TC Plugin Config

include /path/to/wproot/nginx.conf;

# W3TC Plugin Config
include /var/www/vhosts/hostingtipp.ch/httpdocs/nginx.conf;

Setup W3TC on NGINX

Plugin has great and advanced features as New Relic integration for monitoring, cache purging for Varnish - insignificant to us, has great CDN support both for CloudFlare with extension and with MaxCDN, extension to play nice with WordPress SEO by Yoast plugin that we use extensively.

In the future, I can easily switch storage backends, if needed.

All of this functionality is possible to be achieved with separate plugins.

WP Super Cache

WP Super Cache caches to disk and has no way of controlling user-land object or db cache - it is way inferior to W3TC.

Alternative, more focused solutions

APCu Object Cache Backend is clean and small Drop-in plugin, with really only one file object-cache.php.

Install and then we must type:

cd /var/www/vhosts/hostingtipp.ch/httpdocs
mv wp-content/plugins/apcu/object-cache.php wp-content/object-cache.php


WP-FFPC supports both PHP Memcache and Memcached extensions.

  1. Moram W3TC zbog CDN i New Relic-a (ne koristi mi ništa jer je to Javascript verzija), npr Ugasi full-page cache, ostalo ostavi

  2. Moram APCu jer je to najbrži object cache (i nije najbrži) Takođe ga mogu koristiti za full-page cache (umesto nginx recimo)

  3. Ostaje tema - full page cache-a

Speed Up WordPress With W3 Total Cache On Nginx Web Server » Liberian Geek Best LightWeight W3 total cache settings For Shared Hosting

The Importance of Caching WordPress » KBeezie


Cachify is indirectly recommended by KeyCDN authors, but to me it is too much of a “black box”. Can work with nginx and it’s memcached module, as explained in this gist by plugin author.

It doesn’t work with APCu nor memcached with PHP. So, avoid it.

W3 Total Cache Settings - Configure & Optimize Your Website

Latest addendum plugin:

Introducing Cache Buddy: a companion for your WordPress page caching solution | Mark on WordPress

Very nice plugin for Cache Busting:


Web Caching Basics: Terminology, HTTP Headers, and Caching Strategies | DigitalOcean

W3TC Configure

Configuring W3 Total Cache: Advance Page Cache I - Tuts+ Code Article Speed up WordPress on Shared Hosting W3 Total Cache | C3M Digital Setting Up Guide for W3 Total Cache

WordPress › NGINX Cache Optimizer « WordPress Plugins - https://wordpress.org/plugins/nginx-cache-optimizer/ Nginx « WordPress Codex - http://codex.wordpress.org/Nginx#Better_Performance_for_Static_Files_in_Multisite

wp-ffpc vs - Google Search - https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=wp-ffpc%20vs WordPress › Support » wp-ffpc or varnish or both? - https://wordpress.org/support/topic/wp-ffpc-or-varnish-or-both?replies=8 WordPress Optimization/Caching « WordPress Codex - http://codex.wordpress.org/WordPress_Optimization/Caching HTTP Cache headers wordpress test - Google Search - https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=HTTP+Cache+headers+wordpress+test Setup WordPress with W3 Total Cache | MaxCDN One - https://www.maxcdn.com/one/tutorial/setup-wordpress-with-w3-total-cache/ wp-ffpc + w3tc - Google Search - https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=wp-ffpc%20%2b%20w3tc WordPress › Support » A newbie’s guide to using W3TC and FFPC - https://wordpress.org/support/topic/a-newbies-guide-to-using-w3tc-and-ffpc?replies=1 The Best WordPress Caching Plugins - Recommended by Our Readers - http://premium.wpmudev.org/blog/which-wordpress-cache-plugin/ Blog Updates – How We Improved Our Website Performance » Liberian Geek - https://www.liberiangeek.net/2014/10/blog-updates-improved-website-performance/ 10 Million hits a day with WordPress using a $15 server | Ewan’s Blog on IT and stuff10 Million hits a day with Wordpress using a $15 server - Ewan’s Blog on IT and stuff - https://ewan.im/900/10-million-hits-a-day-with-wordpress-using-a-15-server WordPress Nginx | Leadin - http://leadin.com/plugins/wordpress-nginx/ The Best WordPress Cache Plugins And How To Use Them | Elegant Themes Blog - http://www.elegantthemes.com/blog/resources/the-best-wordpress-cache-plugins-and-how-to-use-them WP Super Cache ‹ eTaktiker — WordPress - http://www.etaktiker.rs/wp-admin/options-general.php?page=wpsupercache&tab=settings#top

CORS config on nginx

enable cross-origin resource sharing Wide-open CORS config for nginx Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs Slightly tighter CORS config for nginx http - Access-Control-Allow-Origin Multiple Origin Domains? - Stack Overflow Cross-origin resource sharing - Wikipedia, the free encyclopedia

Nginx has to be compiled with http://wiki.nginx.org/NginxHttpHeadersModule. Then you can do this That module seems to be compiled by default (at least on Ubuntu).

location ~* .(eot|ttf|woff)$ { add_header Access-Control-Allow-Origin *; }

For fonts, we must do it in nginx.

server-configs-nginx/cross-domain-fonts.conf at master · h5bp/server-configs-nginx

Web Fonts - CORS & expires

location ~* .(?:ttf|ttc|otf|eot|woff|woff2)$ { add_header “Access-Control-Allow-Origin” “*”;

# Only one location match is ever executed - therefore the relevant
# location match must contain all relevant rules. The first regular
# expression to match the query will stop the search.
expires 1M;
access_log off;
add_header Cache-Control "public";


Cache busting


Busted! WordPress Cache Busting Techniques Done Right Busted: A WordPress Plugin to Force Cache Busting

Browser caching of static assets

# Cache static content
# Note: webpagetest.org needs a week for A grade
location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
  expires 1w;
  access_log off;
  add_header Cache-Control "public";

Very simple explanation of browser caching headers.

Fragment caching

The key benefit here: you can cache content for logged-in users!

WP Fcashe

WordPress › FragmentCache « WordPress Plugins

From lead developer at Wordpress, the fragment caching as simple as possible: Fragment Caching in WordPress | Mark on WordPress

Fragment Caching in WordPress

Fragment cache (speeding up the admin)

Blunt Cache

Short-circuit with hooks (and use cache) #23627 (Allow plugins to short-circuit wp_nav_menu, good for performance) – WordPress Trac

Object Cache SLOWED down the site

One last thing to add regarding W3 Total Cache, do not enable Object Cache. That bypasses the WordPress Transients API which the Datafeedr plugins rely on for storing data to reduce the number of API requests required to build and update your products.

? Thanks for that Eric. I’ve found problems in the past when using W3 Total Cache object cache or database cache.

date 01. Jan 0001 | modified 29. Dec 2023
filename: WordPress - Speed - Cache