Skip to content

Instantly share code, notes, and snippets.

@timersys
Last active May 10, 2018 20:14
Show Gist options
  • Save timersys/2f318678d81b3397c53d76843669e651 to your computer and use it in GitHub Desktop.
Save timersys/2f318678d81b3397c53d76843669e651 to your computer and use it in GitHub Desktop.
Change WpRocket cache level for Geotargeting WP or disable it
<?php
/**
* By default WpRocket plugin will create different cache pages at a country level
* To add more levels (states or cities) you need to add the following filter
*/
add_filter('rocket_geotargetingwp_enabled_cookies', function($enable){
$enable[] = 'state';
//$enable[] = 'city';
return $enable;
});
/**
* To DISABLE all cookies because for example don't want to use cache mode
* you can add this code
*/
add_filter('rocket_geotargetingwp_enabled_cookies', function(){ return [];});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment