Introductie
Snippets
GForms
ACF
Algolia
BuddyPress
Contact Form 7
Ewww image optimizer
Ninja Forms
Trusted Shops
Wishlist
WP Rocket
Default settings
<?php
/**
* Remove cache when theme options are saved
*/
function clear_wprocket_cache() {
$screen = get_current_screen();
if (strpos($screen->id, "theme-general-settings") == true) {
// Clear cache.
if (function_exists('rocket_clean_domain')) {
rocket_clean_domain();
// Generate a new random key for minify cache file
$options = get_option('wp_rocket_settings');
$options['minify_css_key'] = rand(1, 99999999999);
$options['minify_js_key'] = rand(1, 99999999999);
remove_all_filters('update_option_' . 'wp_rocket_settings');
update_option('wp_rocket_settings', $options);
}
// Preload cache.
if (function_exists('run_rocket_sitemap_preload')) {
run_rocket_sitemap_preload();
}
}
}
add_action('acf/save_post', 'clear_wprocket_cache', 20);
// exclude files from defer by default
add_filter('rocket_exclude_defer_js', function ($excluded_files) {
$excluded_files[] = '/cookieconsent2/';
return $excluded_files;
});
Other
This is the section we should try never to use.