manifest / performance / wp-fastcgi-cache-purger
WP FastCGI Cache Purger
WordPress plugin that purges Nginx FastCGI cache on content changes, from the admin bar, or via WP-CLI
by Azan Umer · github.com/azanumer/wp-fastcgi-cache-purger · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/azanumer/wp-fastcgi-cache-purger/archive/refs/heads/main.zipWordPress plugin that purges the Nginx FastCGI cache — no nginx helper module required. It deletes cache files directly from PHP, so it works on any VPS where PHP has write access to the cache directory.
What it does
- Auto-purge on content changes — post/page save, delete, trash, comment add/edit, theme switch, widget or menu changes
- Admin bar "Purge Cache" button for one-click full purge (capability:
manage_options, nonce-protected) - WP-CLI commands:
wp fcgipurge allandwp fcgipurge url <url> - Targeted purge — computes the nginx cache key hash (
md5("$scheme$request_method$host$request_uri")) for a URL and deletes only that file instead of the whole cache
Requirements
- WordPress 5.8+, PHP 7.4+
- Nginx with
fastcgi_cache_path(seenginx-config-snippet.conf) - PHP (www-data) must have write access to the cache directory
Installation
- Copy
wp-fastcgi-cache-purger.phpintowp-content/plugins/wp-fastcgi-cache-purger/ - Copy
nginx-config-snippet.confrules into your nginx config (instructions are in the file) - Activate the plugin, then go to Settings → FastCGI Purger and enter your cache path (default
/var/cache/nginx/fastcgi) - The page tells you whether the path is writable
Cache key notes
The targeted URL purge assumes your nginx uses:
fastcgi_cache_key "$scheme$request_method$host$request_uri";
If your key is different (e.g. includes cookies or mobile variants), adjust the fcgi_cache_key_hash() function to match. Full purges always work regardless of the key.
MIT licensed.