rocket_clean_domain()

Use the rocket_clean_domain() function when you want to purge a complete domain from the cache, that is: clear the cache for your entire website.

Additionally, when the Preload feature is enabled, the rocket_clean_domain() function will also trigger preloading.

If you want to use this function, it is recommended to first check if it's available to avoid any errors in the case WP Rocket is disabled. The correct way to check the function availability is by using function_exists:

if(function_exists('rocket_clean_domain' ) ) {    
    // it's available, let's clear the cache     
    rocket_clean_domain(); 
}

If your website is multilingual, you can specify the language to be cleared.

// clean the default domain
rocket_clean_domain();

// clean the French domain only
rocket_clean_domain( 'fr' );

Note: WP Rocket supports Polylang and WPML plugins for multilingual content.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.