Im not speaking about purge product and categories when quantity stock changed. Im speaking about public/update product. I want when i add new product to not be visible instantly but after midnight purge whole site.
and have shop cached whole day without purging sites, when i make some critical change i always pruging it manually.
Ok
Thank you for context.
There are some actions added when woocommerce is active: \litespeed-cache\thirdparty\woocommerce.cls.php
Also products are considered post types. I would look for a way to cancel purge when specific post type is added/edited/deleted.
when specific post type is added/edited/deleted.
I meant to say: when specific post is added in product post type is added/edited/deleted.
Plugin Support
qtwrk
(@qtwrk)
add_action('woocommerce_update_product', 'lscwp_suppress_purge_product_update', 10, 2);
function lscwp_suppress_purge_product_update($product_id, $product) {
ob_start( function($buffer) use ($product_id) {
@header("X-LiteSpeed-Purge: nothing" );
return $buffer;
} );
}
please try this code.
Thanks, i will try and get back to you when i test it.
Hi, i added this code into wp code snippet and run everywhere, i tested it but when i published new product, categories were purged. I need when i edit or add new product, to not purge woocommerce categories pages.
Plugin Support
qtwrk
(@qtwrk)
[root@cp apache2]# tail -f error_log | grep -i x-litespeed-purge
2024-09-26 11:41:49.184132 [DEBUG] [3013287] [T0] [79.xxx.xxx.110:63342-H3:AD5B80B9427449D0-840#APVH_woo.xxx.com:lsapi] Response Header: 'X-LiteSpeed-Purge: nothing'
2024-09-26 11:41:49.184134 [DEBUG] [3013287] [T0] [79.xxx.xxx110:63342-H3:AD5B80B9427449D0-840#APVH_woo.xxx.com:lsapi] append response header: X-LiteSpeed-Purge: nothing
I just tested it , it works on my test, edit it by URL like /wp-admin/post.php?post=48&action=edit
what exactly did you do ?
Plugin Support
qtwrk
(@qtwrk)
I was doing theme’s functions.php , what happens if you do the same way ?
https://stofex.com/wp-admin/post.php?post=41813&action=edit
I add this code into theme functions does not work, then in functions.php also does not work. Im lost
When i publish new product all categories are purged. When i just edit published product this code works great. So i need to add when i add new product dont purge categories.