Skip to content

Post Poster 1.1.0 — automatic cache invalidation

Latest

Choose a tag to compare

@SurefireStudios SurefireStudios released this 09 Sep 22:37

Grids now update when your posts do. Cached grids are cleared automatically whenever a
post changes, instead of serving stale results until the cache duration expires.

📥 Install

Download post-poster.zip below, then Plugins → Add New → Upload Plugin. Upgrading
from 1.0.x is a straight replace — your settings are kept, and the new behaviour is on by
default.

✨ Automatic cache invalidation

Previously, publishing or editing a post left the front end showing the old grid until its
cache_minutes window ran out. With cache_minutes="1440" that could be a full day, which
reads as the plugin being broken.

Cached grids are now cleared when a post is published, updated, trashed, untrashed or
deleted
, with the details handled properly:

  • Autosaves and revisions are ignored, so drafting doesn't thrash the cache
  • The clear runs once per request, so a bulk edit or a 200-post import does the work once
    rather than 200 times
  • Only relevant post types count — grids query the post type, and the new
    pp_cache_invalidation_post_types filter lets you widen that
  • A pp_cache_cleared action fires each time, so you can purge a page cache or CDN
    alongside it

New Cache Settings panel

On the Post Poster admin screen:

Control What it does
Clear cached grids automatically… On by default. Turn it off to rely purely on cache_minutes expiry
Clear Cache Now Clears every cached grid immediately, regardless of the setting

Both are behind a capability check and a nonce.

🐛 Also fixed

Cache clearing didn't work with a persistent object cache. clear_all_cache() only
deleted rows from wp_options, which does nothing when Redis or Memcached is handling
transients — so on those sites the new invalidation would have silently failed. Cache keys
are now tracked in a bounded index and removed with delete_transient(), which works with
either backend. The old options sweep is kept as a fallback for keys written by earlier
versions.

uninstall.php removes the new option, and the translation template was regenerated from
source — 94 real strings, replacing 60 hand-written ones and a support URL that pointed at a
wordpress.org page that doesn't exist.

✅ How this was verified

tests/test-cache.php stubs WordPress so the logic can be exercised without a database —
29 assertions, all passing on PHP 7.4 and 8.3 in CI:

  • the key index records, de-duplicates, bounds and clears correctly
  • the setting defaults to on for installs that predate it
  • revisions, autosaves and non-matching post types don't trigger a clear
  • trashing, untrashing and fully deleting a post do
  • 50 consecutive saves in one request do no extra work
  • force_clear() works even with the setting off

📋 Requirements

  • WordPress 6.0+ (tested up to 6.4)
  • PHP 7.4+

📄 License

GPL-3.0. Built by Surefire Studios.