Support » Plugin: LiteSpeed Cache » Clear private cache page from PHP

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support stanley@litespeed

    (@stanleylitespeed)

    Hi @justin-dixon, you can purge private cache by tag on LiteSpeed Setting > Manage > Purge By... Tag, which you can find the tag on the bottom of the HTML source code.

    Hello @stanleylitespeed,

    I said PHP because I needed to clear a customers cache for a specific privately cached page programmatically after they change a setting on their account. If the cache of the page was not cleared it would not reflect the setting change.

    I have already found the solution though… To clear LiteSpeed you can use these HTTP headers.

    Then to add HTTP headers to WordPress you can see this stack overflow answer.

    So should look something like this;

    
    function ff_clear_cache() {
    	header("X-LiteSpeed-Purge: private, *");
    }
    
    //add this whenever you need cache cleared programmatically
    add_action( 'send_headers', 'ff_clear_cache' );
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Clear private cache page from PHP’ is closed to new replies.