pepe80
Forum Replies Created
-
@mrclayton thank you for the quick response! I understand that the “wc_stripe_create_setup_intent” filter is part of your plugin? I can’t find anything about it in the documentation.
I’m concerned that I would be displaying a payment amount of $0. The customer should know the price because they will ultimately have to pay it. Besides, sales amounts need to be saved in WordPress because commissions will be paid based on them.
- This reply was modified 1 month, 1 week ago by pepe80.
Hi @litetim
how are the crons spawned? Do you use wget or php function?
As I mentioned at the beginning, I use wget:
wget -q -O - https://mydomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1I have debugged the problem and I was able to see the what problem you reported
Does this mean that the bug you found will be fixed in future versions?
Unfortunately, I was unable to test your changes. When I uploaded only these two files from the commit: src/core.cls.php, src/purge.cls.php
…I got errors on the website:Class "LiteSpeed\Optimax" not found in /wp-content/plugins/litespeed-cache/src/root.cls.php:221When I downloaded and installed the entire branch: https://github.com/timotei-litespeed/lscache_wp/tree/d4db6df3b6bd69f2d8e36097bff15e48998b6b49, the website started behaving strangely, e.g., sending Contact Form 7 forms stopped working.
In the meantime, I found a solution that works and clears the entire cache every time 🙂 I am sending the header “X-LiteSpeed-Purge: *” instead of calling “litespeed_purge_all” action:
// Function called by cron
function purge_cache() {
wp_remote_get('https://mydomain.com?purge-posts=1');
}
if (!empty($_GET['purge-posts'])) {
@header("X-LiteSpeed-Purge: *");
exit;
}@litetim I have a comment about your plugin: to test whether the cache has been cleared for 1,000 pages, you would first have to generate a cache for those 1,000 pages. Have you done that? 🙂
My solution is to clear the entire cache and one minute later launch a crawler that visits all pages and checks whether the response header contains “hit” or “miss” and save it in the logs. Below is a snippet of code. I launch the function in a loop for each page and have safeguards against server overload (I process 5 pages per minute). But that is irrelevant to our discussion.
/**
* Visit URL to generate cache
*
* @param string $url URL to visit.
* @return array
*/
function visit_url($url) {
$headers = [
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_USERAGENT => 'Cache Crawler',
CURLOPT_HTTPHEADER => $headers,
]);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
$error = curl_error($ch);
if ($error) {
return [
'http_code' => 0,
'status' => $error,
];
}
$status = (strpos($response, 'x-litespeed-cache: hit') !== false) ? 'hit' : 'miss';
return [
'http_code' => $info['http_code'],
'status' => $status,
];
}@litetim Thank you for your involvement 🙂 Let’s wait for your test results. The problem is reproducible in my environment. I have two weeks of logs, and every night it’s the same – the cache is cleared for most pages, but there are always 8-20 pages/posts that don’t have their cache cleared.
@litetim :
– There are no errors on PHP side
– Crons are correctly set to server side
– Report ID: XBCPVPBR@litetim I don’t know what you mean. Please let’s take this issue seriously. I’ve found unusual bugs in LiteSpeed in the past:
https://ww.wp.xz.cn/support/topic/lswcp_tag_prefix-bug-when-multisite/
https://ww.wp.xz.cn/support/topic/duplicate-url-parameters-and-redirect-loop/
https://ww.wp.xz.cn/support/topic/purge-cache-when-post-status-changes-via-cron/
…so let’s look into this seriously.My plugin works like this:
- Clears the cache of all pages
- Visits all pages by sending a request using curl
- Checks the “x-litespeed-cache: hit/miss” header in the response
I also check some pages manual in incognito mode in my browser and looking at the generated tag:
<!-- Page cached by LiteSpeed Cache 7.7 on YYYY-MM-DD hh:mm:ss -->The conclusion is: the cache is not cleared for all pages.
You wrote:
From my experince clear all will do clear all the pages.
…but have you checked how the “litespeed_purge_all” action works when called inside a WordPress cron event? Because, as I mentioned at the beginning, I encountered the same problem a few years ago in a completely different environment. I am convinced that there is some bug that has not yet been detected 🙂
@litetim I ran the test. The logs indicate that your code executed. Unfortunately, it behaves identically to the “litespeed_purge_all” action:
Number of pages and posts: 112
Cache cleared (miss): 87
Cache not cleared (hit): 25The code executed at 2026-02-20 04:00:04. For example, the homepage has this tag in the html source:
<!-- Page cached by LiteSpeed Cache 7.7 on 2026-02-19 20:24:06 -->I know exactly which pages have their cache cleared because my plugin is also a crawler that visits all pages after clearing the cache (hosting provider refused to run the crawler built into the LiteSpeed plugin). Here’s an example page that has been successfully cleared and visited by my crawler:
<!-- Page cached by LiteSpeed Cache 7.7 on 2026-02-20 04:04:02 -->@litetim I’m aware of these options, but my client would need to constantly update the URL list, so I’m creating a plugin for them that also performs various additional tasks. As a PHP developer, I’d prefer to figure out why the “litespeed_purge_all” action doesn’t clear the cache for all pages when called in a recurring WordPress task. If I can provide any logs or debug anything, I’m available.
I can confirm that I’m experiencing the same problem. Every 2-3 days, emails suddenly stop being sent. I see a 422 “Unauthorized” error in the logs.
A question for the plugin authors: how is the token validity refresh mechanism implemented? Does it rely on WordPress’s cron function? If so, that’s where I’ll be looking for the cause. I suspect that when the site has low traffic and only WordPress’s “pseudo cron” mechanism is enabled, the token isn’t refreshed.
Hi @saranshwpm I sent my contact information through the form on your website (the “Contact” tab).
Hey guys. 3 weeks with no response 🙁 Could someone confirm that the problem I reported actually occurs in a multisite environment?
@wfpeter thank you very much for explaining, everything is clear 🙂 Then in my script I will exclude tables with the “wf” prefix from cloning.
Forum: Networking WordPress
In reply to: New blog in multisite always with http scheme@siva_selva thank you for this detailed explanation! I use the
wp_initialize_site()function for a script that creates a duplicate page in a multisite environment and then replaces all URL occurrences on the new page from:
https://mainsite.com
to:
http://new.mainsite.com
This is the troublesome moment. Too badwp_initialize_site()doesn’t have an “ssl” input parameter where I could decide for myself whether it should be http or https. I handled it with a hook before I even replace the URLs:add_action('wp_initialize_site', 'mu_duplicator_new_site', 10, 1);
function mu_duplicator_new_site($new_site) {
if (! is_object($new_site)) return;
switch_to_blog($new_site->id);
update_option('siteurl', str_replace('http://', 'https://', get_option('siteurl')));
update_option('home', str_replace('http://', 'https://', get_option('home')));
restore_current_blog();
}That is a good idea and might be something you would want to look into for changing the text in the meantime.
These blocks (buttons) are constructed in such a way that the text can only be entered manually in the back-end editor. These texts are not in the .po files.
I solved it by turning off the css styles that hide these keys in the development console. Thanks to this I was able to enter text 🙂