miniCal Cron Setup

Cron is how miniCal does the scheduling time-based tasks. Several miniCal core features, such as checking for updates and getting bookings from OTA's like Booking, Airbnb, and Expedia, utilize Cron.

Understanding of miniCal Cron Scheduling

miniCal provides hooks to perform the cron job. Use any given action name and add your call-back function. Right now, the default intervals provided by miniCal are:

  • hourly-cron

  • daily-cron

Hourly-cron runs from the 0th hour to the 23rd hour a day, for example, if you have an OTA connection and you want your booking updated at every hour, then you can use this hourly-cron job. The same goes for the daily-cron; if you want to mail you the daily booking list at any specific time, you can use daily-cron for this.

Why Use Cron

  • miniCal core and many extensions need a scheduling system to perform time-based tasks. However, many hosting services are shared and do not provide access to the system scheduler.

  • miniCal makes sure that the job is done on the next page load if the job is not done.

How to Use Cron

// daily cron
add_action('daily-cron', 'your_callback_function', 10, 1);
function your_callback_function($data) {
  // this code will be executed on 0th hour every day
}

// hourly
add_action('hourly-cron', 'your_callback_function', 10, 1);
function your_callback_function($data) {
  // this code will be executed on 0th to 23rd hour every day
}

Last updated