# Flush W3 Total Cache After Design Changes

> Flushes all W3 Total Cache caches when the Customizer, menus or widgets are saved, so site-wide changes are visible straight away.

- Type: PHP
- Runs: Run everywhere
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: w3-total-cache, cache, customizer
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/w3tc-flush-on-settings-change/

## Code

```php
$wpide_flush = function () {
    if ( function_exists( 'w3tc_flush_all' ) ) {
        w3tc_flush_all();
    }
};

add_action( 'customize_save_after', $wpide_flush );
add_action( 'wp_update_nav_menu', $wpide_flush );
add_action( 'update_option_sidebars_widgets', $wpide_flush );
```

## Notes

""

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Flush W3 Total Cache After Design Changes" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
