How to prevent caching of a specific PHP script
-
Hi,
Is there any way to prevent WP-Optimize from caching a specific script on our website.
We are implementing a geo-location redirect script across our various domains, in order to automatically redirect users to the correct website, based on their geographic location.We are using the Woocommerce MaxMind IP address lookup system to determine a users location based on their IP address. And then redirect them to 9the correct website based on this result.
We are hosted with WP-Engine and have already excluded our redirect script from the server cache level.However, cannot find a solution to prevent this script from being cached along with the rest of the page content. Affectively we would need this script to never be processed by WP-Optimize which is PHOP based.
We have tried using the Advanced Cache settings but noting there, allows us to exclude a specific PHP script within our child theme.
And after quite a bit of digging, we have tested our script using multiple different variations of the below, without success.
- define(‘DONOTCACHEPAGE’);
- header(‘Cache-Control: no-cache’);
- wc_maybe_define_constant( ‘DONOTCACHEPAGE’, true );
- wc_nocache_headers();
- WC_Cache_Helper::set_nocache_constants();
- wpo_cache_add_nocache_http_header_with_send_headers_action( $no_cache_because_message );
Is there a Constant, Hook, filter or PHP way to prevent our specif redirect script from ever being cached at all.
Thanks in advance.
Any help would be greatly appreciated.
Philip C
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.