Created
July 22, 2021 06:25
-
-
Save mitchellkrogza/44028d8f53f883e89306cf943e4fe235 to your computer and use it in GitHub Desktop.
WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Plugin Name: WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache | |
* Description: Deactivate the WP Rocket feature that caches WooCommerce Refresh Cart Fragments. | |
* Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/compatibility/wp-rocket-compat-wc-cart-fragments | |
* Author: WP Rocket Support Team | |
* Author URI: http://wp-rocket.me/ | |
* License: GNU General Public License v2 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
* | |
* Copyright SAS WP MEDIA 2018 | |
*/ | |
// Namespaces must be declared before any other declaration. | |
namespace WP_Rocket\Helpers\wc_cart_fragments_cache; | |
// Standard plugin security, keep this line in place. | |
defined( 'ABSPATH' ) or die(); | |
// Deactivate WooCommerce Refresh Cart Fragments Cache | |
add_filter( 'rocket_cache_wc_empty_cart', '__return_false' ); | |
/** | |
* Cleans entire cache folder on activation. | |
* | |
* @author Arun Basil Lal | |
*/ | |
function clean_wp_rocket_cache() { | |
if ( ! function_exists( 'rocket_clean_domain' ) ) { | |
return false; | |
} | |
// Purge entire WP Rocket cache. | |
rocket_clean_domain(); | |
} | |
register_activation_hook( __FILE__, __NAMESPACE__ . '\clean_wp_rocket_cache' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment