• Resolved Oleg Komarovskyi

    (@komarovski)


    Hello,
    Can someone please help me, I’m trying to flush page cache for a single product with this code:

    if(!get_the_content()){
        $generate_content = 'Some Content';
        $update_product_content = array(
            'ID'=>$product_page_id,
            'post_content'=>$generate_content
        );
        wp_update_post($update_product_content);
    
        if(defined('LSCWP_V')){
            do_action('litespeed_purge_url', get_the_permalink());
        } //FLUSH CACHE LiteSpeed
    }

    But nothing’s happening on the front-end after refreshing the page in the browser – I still see cached version of the page, while in the back-end I see message, that cache for the url was succesfully purged.

    I have tried also to use this code:

    if(defined('LSCWP_V')){do_action('litespeed_purge_post', $product_page_id);}

    But with this hook, I don’t even see a message in the back-end, that cache for the page was purged.

    I’m using latest version of LiteSpeed Plugin, WordPress and Woocommerce with Memcache Object Caching & OPcache.

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

    (@qtwrk)

    please try full URL path

    e.g.

    do_action( 'litespeed_purge_url', 'https://domain.com/2021/08/04/test/' );

    and don’t forget the ' that wraps URL.

    ——update —–

    I think this ought do it

    do_action('litespeed_purge_url', set_url_scheme( get_site_url() ) . get_the_permalink() );

    • This reply was modified 3 years, 3 months ago by qtwrk.
Viewing 1 replies (of 1 total)
  • The topic ‘Purge all caches for single product page programmatically?’ is closed to new replies.