• Resolved fsalvail

    (@fsalvail)


    Hi, I’m using litespeed cache with Litespeed server and I tried to create a function like this one:

    //Function to purge specific URLs
    function purge_specific_urls() {
    // Liste des URLs à purger
    $urls_to_purge = array(
    'https://example.com/page1',
    'https://example.com/page2',
    // Add other URLs here
    );
    // Loop through each URL and purge the cache
    foreach ( $urls_to_purge as $url ) {
    LiteSpeed_Cache::purge_url( $url );
    }
    }

    But the command LiteSpeed_Cache::purge_url( $url ) not seems to works, is there a setting on the litespeed server that I need to do to make it work?

    By the the command header(‘x-litespeed-purge:/****/’); is working but only for a URL

    If you can help me with this, it will be great since I checked on many forums and found nothing to help me.

    Thanks !

    Francois

Viewing 1 replies (of 1 total)
  • Plugin Support qtwrk

    (@qtwrk)

    please try this in your foreach

    if (defined('LSCWP_V')) {
    do_action( 'litespeed_purge_url', $url );
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Trying to create a function to purge cache for few URLs’ is closed to new replies.