For sites wanting fine-grained control over how their responses are represented in their edge cache, Pantheon Advanced Page Cache is the golden ticket. Here's a high-level overview of how the plugin works:
- When a response is generated, the plugin uses surrogate keys based on WordPress' main
WP_Query
object to "tag" the response with identifers for the data used in the response. See the "Adding Custom Keys" section for including your own surrogate keys.
- When WordPress data is modified, the plugin triggers a purge request for the data's corresponding surrogate keys.
Because of its surrogate key technology, Pantheon Advanced Page Cache empowers WordPress sites with a significantly more accurate cache purge mechanism, and generally higher cache hit rate. It even works with the WordPress REST API.
Go forth and make awesome! And, once you've built something great,
send us feature requests (or bug reports).
To install Pantheon Advanced Page Cache, follow these steps:
- Install the plugin from WordPress.org using the WordPress dashboard.
- Activate the plugin.
To install Pantheon Advanced Page Cache in one line with WP-CLI:
wp plugin install pantheon-advanced-page-cache --activate
2.1.0 (8 August 2024)
- Adds any callable functions hooked to the
pantheon_cache_default_max_age
filter to the message that displays in the WordPress admin when a cache max age filter is active. [#292] This gives some context to troubleshoot if the filter is active somewhere in the codebase. If an anonymous function is used, it is noted in the message that displays.
- Removes the hook to
nonce_life
and replaces it with a new action (pantheon_cache_nonce_lifetime
, see documentation). [#293] This was erroneously overriding any admin settings and setting the default cache max age for some sites to always be 23 hours (the nonce lifetime minus 1 hour). This solution requires that developers add the do_action
when they are creating nonces on the front-end, but allows the cache settings to work as designed in all other instances.
2.0.0 (28 May 2024)
- Adds new admin alerts and Site Health tests about default cache max age settings and recommendations [#268, #271]. The default Pantheon GCDN cache max age value has been updated to 1 week in the Pantheon MU plugin. For more information, see the release note.
- Updated UI in Pantheon Page Cache admin page when used in a Pantheon environment (with the Pantheon MU plugin). [#272] This UI change takes effect when Pantheon MU plugin version 1.4.3 is available on your site.
- Automatically updates the cache max age to the recommended value (1 week) if it was saved at the old default value (600 seconds). [#269]
- Adds a hook into the
nonce_life
filter when nonces are created on the front-end to set the pantheon_cache_default_max_age
to less than the nonce lifetime to avoid nonces expiring before the cache does. [#282] props @ryanshoover
1.5.0 (11 March 2024)
- Adds filter
pantheon_purge_post_type_ignored
to allow an array of post types to ignore before purging cache [#258]
- Adds wpunit-helpers for running/setting up WP Unit tests
1.4.2 (October 16, 2023)
- Updates Pantheon WP Coding Standards to 2.0 [#249]
- Fixes an issue where a PHP warning was thrown when surrogate keys were emitted from archive pages with multiple post types. [#252]
1.4.1 (August 8, 2023)
1.4.0 (August 1, 2023)
- Bumped Dependencies [236]
- Add filter
pantheon_should_add_terms
to allow disabling surrogate keys for posts' taxonomy terms [239]
1.3.0 (April 19, 2023)
- Adds support for WordPress Multisite which resolves issue where editing a Post on one subsite clears the home page cache of other sites in the Multisite install if it has a Post containing the same ID [#228].
1.2.4 (April 13, 2023)
- Adds surrogate key to post-type archive pages (e.g. "portfolio") that's specific to that archive(e.g. "portfolio-archive"), and clears that archive where appropriate [#225].
1.2.3 (April 5, 2023)
- Bump tested up to version to 6.2
1.2.2 (March 14, 2023)
- Adds PHP 8.2 compatibility [#218].
- Bump dependencies [#204].
1.2.1 (February 23, 2023)
- Handle models that are not instances of the
WPGraphQL\Model\Model
class [#212].
- Make dependabot target develop branch [#209].
- Bump dependencies [#210] [#214].
1.2.0 (November 29, 2022)
1.1.0 (November 1, 2022)
- Hook into WPGraphQL to emit surrogate keys [#199].
- Add Plugin Integrations section to README
1.0.0 (March 2, 2020)
0.3.1 (October 27th, 2019)
- Fixes reversed argument order with use of
implode()
[#139].
- Various PHPCS cleanup [#127].
0.3.0 (November 27th, 2017)
- Emits '404' surrogate key on 404s; purges when purging the homepage [#107].
- Adds more specific filters for modifying surrogate keys in different contexts [#109].
- Cleans up codebase according to WordPress Coding Standards [#110, #116].
0.2.1 (October 25th, 2017)
- Ensures use of
?_embed
emits correct surrogate keys [#103].
0.2.0 (August 10th, 2017)
- Automatically trims large lists of surrogate keys that break Nginx and Varnish limits for header size.
0.1.5 (May 24th, 2017)
- Disables emitting surrogate keys for the admin, unless explicitly added by filter.
0.1.4 (March 7th, 2017)
- Emits
feed
surrogate key for RSS feeds, and purges when posts are created, modified, or deleted.
0.1.3 (March 1st, 2017)
- Prevents error notices by only accessing
$rest_base
property of post types and taxonomies when set.
0.1.2 (December 6th, 2016)
- Permits admins to flush cache for a specific page if the
delete_others_posts
capability has been deleted.
0.1.1 (November 30th, 2016)
- Drops settings UI in favor of including it in Pantheon's WordPress upstream.
0.1.0 (November 23rd, 2016)