• Resolved rask44

    (@rask44)


    Hi,

    I have this code added in functions.php

    function initPage(){
    $msg = 'test';
    add_action( 'litespeed_purged_all', $msg)
    die('test');
    }

    add_action('init', 'initPage');

    Unfortunately, the output only works after clearing the cache through the admin panel, not after the action is applied. Why is this happening?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support qtwrk

    (@qtwrk)

    because when page is cached already , it won’t trigger PHP or this function

    please explain a bit what exactly is it you want to do ?

    Thread Starter rask44

    (@rask44)

    Hi,
    I need to display a different message depending on the user’s browser language, which is currently impossible because the message is cached and the same one is shown to all users.

    Plugin Support qtwrk

    (@qtwrk)

    RewriteRule .* - [E=Cache-Control:vary=%{HTTP:Accept-Language}]

    please try this at top of your htaccess

    Thread Starter rask44

    (@rask44)

    Thanks, it works

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