WP Rocket Hooks

after_rocket_clean_post action is fired after clear cache of a post.

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

after_rocket_clean_domain action is fired after 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/',
	));
});

Auto preload all urls after clearing all cache

/**
 * Preload all URLs after clearing all cache.
 */
add_action( 'after_rocket_clean_domain', function() {
	run_rocket_bot();
	run_rocket_sitemap_preload();
});

Share your thoughts by leaving a comment below.