Plugin Support
Kush
(@kushnamdev)
Hi @wabetainfo,
Please try this code and let us know if this solves your issue –
function clear_cache($urls) {
// build the path to wp-load.php
$wp_load_path = dirname(__FILE__) . '/../wp-load.php';
if (file_exists($wp_load_path)) {
require_once $wp_load_path;
// trigger the action with your URLs
do_action('swcfpc_purge_cache', $urls);
}
}
// example call
clear_cache(array(
'https://example.com/page1/',
'https://example.com/page2/'
));
Best regards
Hi @kushnamdev
Thanks for your message. I don’t understand the difference between my code and yours (mine just had a syntax error once pasted here, but it was correct in my PHP file). however, I just tested the code and the page still reports “There has been a critical error on this website.”
The log says:
[08-Sep-2025 20:19:25 UTC] PHP Warning: Trying to access array offset on null in /home/website/public_html/wp-content/advanced-cache.php on line 869
[08-Sep-2025 20:19:25 UTC] PHP Warning: Trying to access array offset on null in /home/website/public_html/wp-content/advanced-cache.php on line 829
[08-Sep-2025 20:19:25 UTC] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/website/public_html/wp-content/advanced-cache.php:831
Stack trace: 0 /home/website/public_html/wp-content/advanced-cache.php(77): swcfpc_fallback_cache_is_cookie_to_exclude()
Hi @kushnamdev
Do you have any idea how to do it? Although the code seems correct, the website crashes when I try purging the cache. Thanks.
Plugin Support
Kush
(@kushnamdev)
Hey @wabetainfo,
We were able to replicate the issue you shared and reported to our team for fix. In the meantime you can add this code in your advanced-cache.php file to solve the error.
if ( defined( 'SWCFPC_SKIP' ) {
return;
}
I hope this helps, thank you!
Hi @kushnamdev
Unfortunately, the latest updates still do not implement a fix for the issue. Additionally, I’m not even sure if it will work, as I experience the same critical error even after adding that code to the advanced-cache.php file:
if ( defined( ‘SWCFPC_SKIP’ )) {
return;
}
Hi @kushnamdev
Is there news about this issue? it’s been more than 4 months from my initial report. Thanks!