kaiseki / wp-wp-rocket
Configure WP Rocket: disable automatic cache purging on term changes and tune cache preloading
Requires
- php: ^8.2
- kaiseki/config: ^2.0
- kaiseki/wp-hook: ^2.0
- psr/container: ^1.1 || ^2.0
Requires (Dev)
- bnf/phpstan-psr-container: ^1.1
- kaiseki/php-coding-standard: ^1.0
- maglnet/composer-require-checker: ^4.0
- php-stubs/wordpress-stubs: ^6.2
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.0
- roave/security-advisories: dev-latest
- roots/wordpress-core-installer: *
- roots/wordpress-no-content: @stable
- szepeviktor/phpstan-wordpress: ^2.0
This package is auto-updated.
Last update: 2026-06-02 23:43:40 UTC
README
Configure WP Rocket: disable automatic cache purging on term changes and tune cache preloading.
Two kaiseki/wp-hook HookProviderInterfaces wired through ConfigProvider, both no-ops unless
configured (and unless WP Rocket is active):
DisableAutoPurge— stops WP Rocket from purging the cache on term create/edit/delete and after saving dynamic lists.PreloadConfigurator— overrides the preload batch size, cron interval and delay between requests (config values, or theWP_ROCKET_PRELOAD_*constants if defined).
Installation
composer require kaiseki/wp-wp-rocket
Requires PHP 8.2 or newer.
Usage
Register ConfigProvider with your laminas-style config aggregator, configure the wp_rocket key with
the fluent config objects, and activate the providers via kaiseki/wp-hook:
use Kaiseki\WordPress\WpRocket\DisableAutoPurge\DisableAutoPurge; use Kaiseki\WordPress\WpRocket\DisableAutoPurge\DisableAutoPurgeConfig; use Kaiseki\WordPress\WpRocket\PreloadConfigurator\PreloadConfigurator; use Kaiseki\WordPress\WpRocket\PreloadConfigurator\PreloadConfig; return [ 'wp_rocket' => [ 'preload_config' => PreloadConfig::create() ->withBatchSize(45) ->withCronInterval(60) ->withRequestsDelay(0.5), 'disable_auto_purge' => DisableAutoPurgeConfig::create() ->onTermChange() ->onRocketAfterSaveDynamicLists(), ], 'hook' => [ 'provider' => [ DisableAutoPurge::class, PreloadConfigurator::class, ], ], ];
ConfigProvider registers a factory for each provider; each reads its wp_rocket.* config object from
the container and is inert when that config is absent.
Development
composer install
composer check # check-deps, cs-check, phpstan
License
MIT — see LICENSE.