• I write a custom plugin to import WooCommerce from a custom CRM. I need to purge and disable the cache before importing and enable the cache afterwards programmatically.

    Unfortunately, I can’t find any action or filter that I could use for this. Could you please give me a solution that will allow me to achieve this goal?

    Thank you in advance!

Viewing 5 replies – 1 through 5 (of 5 total)
  • Plugin Support qtwrk

    (@qtwrk)

    you probably don’t need to disable/enable it , but just purge it afterwards

    for that you can use do_action( 'litespeed_purge_all' ); or do_action( 'litespeed_purge_post', 123 ); to purge by post ID where 123 is the post ID

    Thread Starter mistercode

    (@mistercode)

    Thank you @qtwrk for your time and answer.

    I definitely need to disable LSC as it clears the cache in between writing the products and this sometimes causes problems.

    Plugin Support qtwrk

    (@qtwrk)

    do_action( 'litespeed_disable_all', 'Reason to stop debugging' );

    then you can try this

    Thread Starter mistercode

    (@mistercode)

    And how to re-enable it?

    Plugin Support qtwrk

    (@qtwrk)

    it will be autoamtically turn it on on next request

    pseudo code during your import process:

    // other ocde 
    do_action( 'litespeed_purge_all' ); // purge all before turning off
    do_action( 'litespeed_disable_all', 'Reason to stop debugging' ); // turning off on the fly
    // your importing process....

    then on next request , as long as it doesn’t go into your import code , it will have LSCWP on as it was

Viewing 5 replies – 1 through 5 (of 5 total)

You must be logged in to reply to this topic.