Skip to content
super-page-cache

Instant speed boost – enable lazy-loading, defer scripts, and fine-tune caching for blazing-fast pages. Priority support included.

See Pro Plans β†’

Disable Automatic Full Cache Purge on Global Updates ​

By default, Super Page Cache purges the entire site cache when global changes are saved β€” such as editing a navigation menu, switching a theme, or saving Customizer settings. On large sites (50,000+ cached URLs), each of these events can trigger a full purge that overwhelms the server and causes CPU spikes. This guide explains how to selectively disable those automatic full purges while keeping manual purge control intact.

πŸ“ Note: This guide addresses purges triggered by menu, theme, and Customizer updates. For purges triggered by post or page saves, see Optimizing Super Page Cache for Large Sites.

When to Use This Workaround ​

This workaround is appropriate when you can confirm that full cache purges are being triggered specifically by global element changes rather than by content edits.

Symptoms ​

  • CPU spikes immediately after saving a navigation menu, switching a theme, or saving changes in the WordPress Customizer.
  • Server becomes slow or unresponsive for several seconds to minutes after those changes β€” even when no posts were edited.
  • Site performance degrades during routine admin tasks like updating a menu item or adjusting a global header or footer.

Confirm via plugin logs ​

Before adding any code, verify that the purges are actually originating from these global events:

  1. Go to Settings > Super Page Cache, open the General tab, and enable Show Advanced Settings. Click Save Settings.
  2. Go to the Advanced tab, scroll to the Logs Settings section, and enable Log Mode. Click Save Settings.
  3. Save a menu change: go to Appearance > Menus, make a small edit, and click Save Menu.
  4. Download the log file (the download link appears in the Logs Settings section) and look for a full-cache purge entry recorded at the time of the menu save.

If the log shows a full purge triggered immediately by the menu save (or a theme/Customizer save), the hooks described below are the cause.

Add the Code Snippet ​

The plugin hooks several WordPress events to trigger a full cache purge. The snippet below removes those hooks at init priority 0, which runs before the plugin registers them β€” preventing the automatic purges while leaving all other plugin functionality (including manual purges) intact.

⚠️ Important: Test this change on a staging environment before applying it to production. After adding the code, manually purge the cache whenever you update a menu, switch a theme, or save Customizer settings to ensure visitors see the updated content.

Option A: Add to your theme's functions.php ​

  1. Go to Appearance > Theme File Editor (or open the file via FTP/SFTP).
  2. Select your active theme's functions.php file.
  3. Add the following code at the end of the file:
php
add_action( 'init', function () {
    if ( class_exists( 'cache_controller' ) && isset( cache_controller::$instance ) ) {
        $instance = cache_controller::$instance;

        remove_action( 'wp_update_nav_menu',    [ $instance, 'purge_cache_on_theme_edit' ] );
        remove_action( 'switch_theme',          [ $instance, 'purge_cache_on_theme_edit' ] );
        remove_action( 'customize_save_after',  [ $instance, 'purge_cache_on_theme_edit' ] );
        remove_action( 'update_option_theme_mods_' . get_option( 'stylesheet' ),
                       [ $instance, 'purge_cache_on_theme_edit' ] );
    }
}, 0 );
  1. Click Update File.

Must-use plugins load before regular plugins and cannot be accidentally deactivated, making them safer for code that modifies plugin behaviour.

  1. Connect to your server via FTP/SFTP or use your host's file manager.
  2. Navigate to wp-content/mu-plugins/. If the folder does not exist, create it.
  3. Create a new file named disable-spc-global-purge.php and paste the following content:
php
<?php
/**
 * Prevent Super Page Cache from triggering a full purge
 * on nav menu saves, theme switches, and Customizer saves.
 */
add_action( 'init', function () {
    if ( class_exists( 'cache_controller' ) && isset( cache_controller::$instance ) ) {
        $instance = cache_controller::$instance;

        remove_action( 'wp_update_nav_menu',    [ $instance, 'purge_cache_on_theme_edit' ] );
        remove_action( 'switch_theme',          [ $instance, 'purge_cache_on_theme_edit' ] );
        remove_action( 'customize_save_after',  [ $instance, 'purge_cache_on_theme_edit' ] );
        remove_action( 'update_option_theme_mods_' . get_option( 'stylesheet' ),
                       [ $instance, 'purge_cache_on_theme_edit' ] );
    }
}, 0 );
  1. Save the file. WordPress loads it automatically β€” no activation step is required.

πŸ’‘ Tip: Priority 0 ensures this code runs before the plugin has a chance to register its own actions, so the hooks are removed cleanly.

Verification Steps ​

After adding the code, confirm that the hooks have been removed and that manual purging still works.

Test that menu updates no longer trigger a full purge ​

  1. Make sure Log Mode is still enabled (Settings > Super Page Cache > Advanced > Logs Settings).
  2. Go to Appearance > Menus, change a menu item label, and click Save Menu.
  3. Download the updated log file and check the entries recorded at the time of the save.
  4. Confirm that no full-cache purge appears in the log for that event.

Manually purge the cache after the menu update ​

Because automatic purging is now disabled for these events, you need to purge the cache manually after updating a menu, theme, or Customizer settings:

  1. In the WordPress admin toolbar, click CF Cache (or the Super Page Cache toolbar button).
  2. Select Purge CF Cache to clear the Cloudflare cache for the whole site, or use the plugin's dashboard button at Settings > Super Page Cache.
  3. Visit the pages that display the updated menu or theme change in an incognito or private browsing window to confirm that the new content is visible.

Confirm manual purging still works ​

  1. After running a manual purge, download the log file again.
  2. Confirm that a full-cache purge entry appears in the log β€” this verifies that manual purges are functioning normally.

Caveats and Alternatives ​

  • Manual purge required after global changes. With these hooks removed, Super Page Cache will not automatically clear the cache when you update menus, switch themes, or save Customizer settings. You must purge the cache manually after each such change. Visitors will see stale content until you do.

  • Post and page purges are unaffected. This workaround only removes hooks for global element events. Purges triggered by post saves, comment updates, and other content changes continue to work as configured.

  • Theme updates. If you add the snippet to functions.php, it will be removed if you update or replace your theme. Using a must-use plugin (Option B) avoids this problem.

  • For post-related purge optimizations, see Optimizing Super Page Cache for Large Sites, which covers smart purging, queue settings, and preloader management.

⚠️ Important: If your site displays dynamic or personalized menus and theme elements (for example, WooCommerce cart counts in a header), always test thoroughly after adding this code to ensure cached pages still show the correct content for your visitors.