If your code is in WordPress, please call LiteSpeed_Cache_API::purge($tag)
Ref: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:api
If you have specific tags served when visiting that page, you can also purge that instead of URL.
Plugin Support
qtwrk
(@qtwrk)
Hi,
Trigger the following code with URL you desired to purge
<?php
header("X-LiteSpeed-Purge: /your-php.php");
when you want to purge the specific page
Best regards,
My code isn’t in WordPress so can’t use LiteSpeed_Cache_API::purge($tag)
Also have a problem with using header(“X-LiteSpeed-Purge: /your-php.php”) as I get Cannot modify header information – headers already sent by etc
To explain better I have a php file that contains a form which posts back to itself. On submitting, the form fields are used to run query to update database. Once query has run I then want to purge the corresponding page and then redisplay form with fields populated with database values.
How urgent is it to update the page immediately? We do have a setting that will let you schedule a daily purge for a particular page. Would that be sufficient?
It’s in the Settings > Purge tab, all the way at the bottom.
http://php.net/manual/en/function.header.php
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP
We have approximately 14,000 listings which are added to/removed daily by various means. Some automated, some manual via a separate login area outside of WordPress.
It’s the manual ones that I’m wanting to deal with at the moment. I want these to show updated information immediately.
I know header() must be called before any actual output but the php file is an included file so not possible.
Based on your requirement, the purge should be the key point to make it.
You can try some other ways to finish the purge. E.g. if your php is included after output, you can output a iframe/ajax to call a fresh new page which only send that purge header.
Thank you.
Managed to achieve it by using an iframe