• philipsimplynuc

    (@philipsimplynuc)


    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.

    1. define(‘DONOTCACHEPAGE’);
    2. header(‘Cache-Control: no-cache’);
    3. wc_maybe_define_constant( ‘DONOTCACHEPAGE’, true );
    4. wc_nocache_headers();
    5. WC_Cache_Helper::set_nocache_constants();
    6. 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]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Damilare

    (@deabiodun)

    Hi Philip!

    Unfortunately, there is no feature for excluding specific PHP scripts at this time. The only way to prevent caching in your case is to exclude the pages on which the script is applied from caching. This can be done at WP-Optimize > Cache > Advanced settings > URLs to exclude from caching.

    Let us know if there’s any other way we can assist.

    Regards.

    Thread Starter philipsimplynuc

    (@philipsimplynuc)

    Ha lol, ah the joys of being a web developer ??

    Ha ha thanks for the quick reply Damilare?

    I really do appreciate it.

    Philip C

    Plugin Support Damilare

    (@deabiodun)

    Always happy to assist whenever possible.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.