• Resolved Daniel

    (@dhoffmann)


    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)
  • Plugin Author owaisalam

    (@owaisalam)

    Thank you for sharing the additional details. We have successfully replicated the issues you’ve mentioned and will be including the fix in our upcoming releases.

    Plugin Author owaisalam

    (@owaisalam)

    Apologies for my previous comment; please disregard it, as I have since discussed this with the engineering team.

    The solution you shared isn’t the correct approach. The recommended method would be to implement this through a small, separate plugin. This plugin could manage an additional cron job, allowing you to choose specific pages, posts, or custom post types to reset the cache on a custom schedule, leveraging Breeze’s cache management functions. However, as this is a very uncommon use case, we won’t be including it in our plugin. I’ve shared the logic needed to achieve this.

    Thread Starter Daniel

    (@dhoffmann)

    ok thank you. I think this is not so uncommon, as other plugins like fastest cache have this functionality, but others are missing.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.