How can I add any new scheduling interval to UpdraftPlus?

If the built-in scheduling options (every 1 (for databases) / 2 / 4 / 8 / 12 hours, daily, weekly, fortnightly, monthly, quarterly) do not cover what you wanted, then you can easily add a new schedule to UpdraftPlus. To do so, create a directory wp-content/mu-plugins in your WordPress install (if it does not already exist), and create a file in it named ud-schedules.php with contents as below. Note that the example below is for adding an “half-hourly” schedule (i.e. every 1800 seconds) for database backups; you should adapt it according to your needs.

<?php

add_filter('updraftplus_backup_intervals', 'local_updraftplus_backup_intervals', 10, 2);
function local_updraftplus_backup_intervals($ints, $what_for) {
    // $what_for is either 'db' or 'files'
    if ('db' == $what_for) $ints['halfhourly'] = 'Half-hourly';
    return $ints;
}

add_filter('cron_schedules', 'local_cron_schedules', 31);
function local_cron_schedules($schedules) {
    $schedules['halfhourly'] = array('interval' => 1800, 'display' => 'Half-hourly');
    return $schedules;
}

Posted in: Advanced usage

twitterlinkedinFacebook