WP Super Cache icon
Performance & Caching

WP Super Cache hooks reference

  • By Automattic
  • v3.1.5
  • Updated

WP Super Cache 3.1.5 has 6 actions and 36 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when WP Super Cache fires an action
add_action( 'wpsc_after_delete_cache_admin_bar', function( $req_path, $referer ) {
	// Your code runs here.
}, 10, 2 );

// Change a value WP Super Cache is about to use
add_filter( 'wpsc_disable_cache_on_wp_die', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • inc/delete-cache-button.php line 129
    /**
     * Hook into the cache deletion process after a successful cache deletion from
     * the admin bar button.
     */
    do_action( 'wpsc_after_delete_cache_admin_bar', $req_path, $referer );
  • wp-cache.php line 193
    /**
     * Filters whether to disable caching when wp_die() is invoked.
     */
    apply_filters( 'wpsc_disable_cache_on_wp_die', true );
  • gc_cache

    action
    wp-cache-phase2.php line 3627 · used in 7 places
    do_action( 'gc_cache', 'prune', $permalink );
  • inc/cache-files.php line 366 · used in 4 places
    do_action( 'wp_cache_cleared' );
  • inc/preload.php line 175 · used in 3 places
    apply_filters( 'wp_cache_preload_taxonomies', array( 'post_tag' => 'tag', 'category' => 'category', ) );
  • wp-cache-phase2.php line 3531 · used in 3 places
    apply_filters( 'wp_super_cache_clear_post_cache', true, $post );
  • wp-cache-phase2.php line 1921 · used in 2 places
    apply_filters( 'do_createsupercache', $user_info );
  • ossdl-cdn.php line 37 · used in 2 places
    apply_filters( 'ossdl_off_blog_url', $ossdl_off_blog_url );
  • inc/lifecycle.php line 447 · used in 2 places
    apply_filters( 'wpsc_enable_wp_config_edit', true );
  • wp-cache-phase2.php line 1339
    apply_filters( 'all_supercache_filenames', $filenames );
  • inc/admin-ui.php line 623
    apply_filters( 'cached_mobile_browsers', $wp_cache_mobile_browsers );
  • inc/admin-ui.php line 629
    apply_filters( 'cached_mobile_groups', array() );
  • inc/admin-ui.php line 624
    apply_filters( 'cached_mobile_prefixes', $wp_cache_mobile_prefixes );
  • got_rewrite

    filter
    rest/class.wp-super-cache-rest-get-status.php line 106
    apply_filters( 'got_rewrite', $got_rewrite );
  • inc/boost.php line 137
    do_action( 'jb_cache_moved_to_wpsc' );
  • wp-cache-phase2.php line 1137
    apply_filters( 'supercache_dir', $dir );
  • wp-cache-phase2.php line 1365
    apply_filters( 'supercache_filename_str', $extra_str );
  • inc/htaccess.php line 181
    apply_filters( 'supercacherewriteconditions', $condition_rules );
  • inc/htaccess.php line 214
    apply_filters( 'supercacherewriterules', $rules );
  • wp-cache-phase2.php line 2626
    apply_filters( 'wp_cache_eof_tags', '/(<\/html>|<\/rss>|<\/feed>|<\/urlset|<\?xml)/i' );
  • wp_cache_gc

    action
    wp-cache-phase2.php line 3332
    do_action( 'wp_cache_gc' );
  • wp_cache_meta

    filter
    wp-cache-phase2.php line 3210
    apply_filters( 'wp_cache_meta', $wp_cache_meta );
  • wp-cache-phase2.php line 2410
    apply_filters( 'wp_cache_ob_callback_filter', $buffer );
  • inc/admin-ui.php line 635
    apply_filters( 'wp_super_cache_error_checking', true );
  • wp-cache-phase2.php line 918
    apply_filters( 'wp_super_cache_supercachedir', $cache_path . 'supercache/' . trailingslashit( strtolower( preg_replace( '/:.*$/', '', str_replace( 'http://', '', str_replace( 'https://', '', $home ) ) ) ) ) );
  • wp-cache-phase2.php line 541
    apply_filters( 'wpsc_accept_headers', array( 'application/json', 'application/activity+json', 'application/ld+json' ) );
  • inc/cache-files.php line 15
    apply_filters( 'wpsc_cache_state', array( 'expired', 'cached' ) );
  • inc/cache-files.php line 14
    apply_filters( 'wpsc_cache_types', array( 'supercache', 'wpcache' ) );
  • wpsc_cdn_urls

    filter
    ossdl-cdn.php line 216
    apply_filters( 'wpsc_cdn_urls', $ossdl_arr_of_cnames );
  • inc/lifecycle.php line 491
    do_action( 'wpsc_created_advanced_cache' );
  • inc/htaccess.php line 265
    apply_filters( 'wpsc_htaccess_mod_expires', $expires_rules );
  • inc/htaccess.php line 238
    apply_filters( 'wpsc_htaccess_mod_headers', $headers );
  • wp-cache-phase2.php line 2152
    apply_filters( 'wpsc_known_headers', $known_headers );
  • inc/preload.php line 622
    apply_filters( 'wpsc_minimum_preload_interval', 10 );
  • wp-cache-phase2.php line 2478
    apply_filters( 'wpsc_only_cache_known_pages', 1 );
  • inc/preload.php line 597
    apply_filters( 'wpsc_preload_post_types', get_post_types( $preload_type_args, 'names', 'or' ) );
  • inc/preload.php line 592
    apply_filters( 'wpsc_preload_post_types_args', array( 'public' => true, 'publicly_queryable' => true ) );
  • wp-cache-phase2.php line 1494
    apply_filters( 'wpsc_protected_directories', array( $cache_path . '.htaccess', $cache_path . 'index.html', $blog_cache_dir, $blog_cache_dir . 'index.html', $blog_cache_dir . 'meta', $blog_cache_dir . 'meta/index.html', $cache_path . 'supercache/index.html', $cache_path . 'supercache', ) );
  • inc/lifecycle.php line 674
    apply_filters( 'wpsc_send_uninstall_errors', 1 );
  • wp-cache-phase2.php line 2618
    apply_filters( 'wpsupercache_404', false );
  • wp-cache-phase2.php line 2771
    apply_filters( 'wpsupercache_buffer', $buffer );

Generated from WP Super Cache's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

We can build the customisation for you. Describe what you need: