WP Rocket Hooks

after_rocket_clean_post action is fired when you clear cache of a post.

add_action( 'after_rocket_clean_post', function( $post, $purge_urls, $lang ) {
	if ( $post->post_name == 'foo' ) {
		rocket_clean_files( 'https://example.com/foo/' );
	}
}, 10, 3 );

after_rocket_clean_domain action is fired when you clear cache of whole domain (clear all cache).

add_action( 'after_rocket_clean_domain', function() {
	rocket_clean_files( array(
		'https://example.com/foo/',
		'https://example.com/bar/',
	));
});

Share your thoughts by leaving a comment below.