Clear WP Rocket When Site Settings Change
Clears WP Rocket's whole-site cache when you save the Customizer, change menus or edit widgets, so header, footer and sidebar changes show up immediately.
Opens WPIDE on
Code
$wpide_clear = function () {
if ( function_exists( 'rocket_clean_domain' ) ) {
rocket_clean_domain();
}
};
add_action( 'customize_save_after', $wpide_clear );
add_action( 'wp_update_nav_menu', $wpide_clear );
add_action( 'update_option_sidebars_widgets', $wpide_clear );
Notes
WP Rocket already clears for theme switches; this covers the everyday design edits.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.