Okay
  Public Ticket #2412689
Run import for calendar more frequently than hourly
Closed

Comments

  • Phillip started the conversation

    can we run the import for a calendar more frequently than hourly? we have a time critical calendar that we would like updated quicker

  •  793
    Zhivko replied

    Hi,

    1) Go to your theme functions.php file and register new 5 minutes schedule interval:

    // Adds 5 minute schedule interval
    add_filter('cron_schedules', function($schedules) {
        $schedules['five_minutes'] = array(
            'interval' => 300,
            'display'  => esc_html__('Every Five Minutes'));
        return $schedules;
    });

    2) Open file stachethemes_event_calendar\assets\php\install\activate.php

    edit line 44:

    wp_schedule_event(time(), 'hourly', 'stec_cronjobs_hourly');

    to:

    wp_schedule_event(time(), 'five_minutes', 'stec_cronjobs_hourly');
    

    3) Deactivate and Re-activate the calendar from Dashboard -> Plugins.

    Now your hourly schedules will run every 5 minutes.

    NOTE: Please read how wordpress cron works here: https://developer.wordpress.org/plugins/cron/

    Tldr: WP-Cron does not run constantly as the system cron does; it is only triggered on page load.

    To make your cron jobs "real" cron jobs check this article.



    Stachethemes Developer