• Resolved growora

    (@growora)


    Hello,

    I would like to know if there is an official way to clear the LiteSpeed Cache in WordPress using a URL query. If so, could you please provide the documentation link or the specific URL structure for purging the cache?

    Thank you.

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

    (@litetim)

    Hello @growora


    If request comes from a page on your site:

    $action = 'purge_all';
    $data = array(
    ? ? LiteSpeed\Router::ACTION => $action,
    ? ? LiteSpeed\Router::NONCE => wp_create_nonce($action),
    );

    $url = admin_url('admin-ajax.php');
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($curl);
    curl_close($curl);

    If you want something else try playing with LiteSpeed\Purge class.

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