Clear URL daily
-
Hello,
I want three pages of my site to be cleared daily, because it contains events. The rest can be managed by breeze (all 30 days). Does the following code work? I don’t think so, do you have a solution? It is from an AI:
Best Daniel
—Code starts here —function clear_breeze_cache_daily() {
// Array of URLs to clear cache
$urls_to_clear = [
'https://example.de/',
'https://example.de/veranstaltungen/',
'https://example.de/veranstaltungsarchiv/',
];
// Clear cache for each URL
if (function_exists('breeze_cache_clear')) {
foreach ($urls_to_clear as $url) {
breeze_cache_clear($url);
}
}
}
// Schedule the event if not already scheduled
if (!wp_next_scheduled('clear_breeze_cache_daily_event')) {
wp_schedule_event(time(), 'daily', 'clear_breeze_cache_daily_event');
}
// Hook the function to the scheduled event
add_action('clear_breeze_cache_daily_event', 'clear_breeze_cache_daily');The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.