wp_get_schedules

The timeline below displays how wordpress function wp_get_schedules has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Retrieves supported event recurrence schedules.
 *
 * The default supported recurrences are 'hourly', 'twicedaily', 'daily', and 'weekly'.
 * A plugin may add more by hooking into the {@see 'cron_schedules'} filter.
 * The filter accepts an array of arrays. The outer array has a key that is the name
 * of the schedule, for example 'monthly'. The value is an array with two keys,
 * one is 'interval' and the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run.
 * So for 'hourly' the time is `HOUR_IN_SECONDS` (60 * 60 or 3600). For 'monthly',
 * the value would be `MONTH_IN_SECONDS` (30 * 24 * 60 * 60 or 2592000).
 *
 * The 'display' is the description. For the 'monthly' key, the 'display'
 * would be `__( 'Once Monthly' )`.
 *
 * For your plugin, you will be passed an array. You can easily add your
 * schedule by doing the following.
 *
 *     // Filter parameter variable name is 'array'.
 *     $array['monthly'] = array(
 *         'interval' => MONTH_IN_SECONDS,
 *         'display'  => __( 'Once Monthly' )
 *     );
 *
 * @since 2.1.0
 * @since 5.4.0 The 'weekly' schedule was added.
 *
 * @return array {
 *     The array of cron schedules keyed by the schedule name.
 *
 *     @type array ...$0 {
 *         Cron schedule information.
 *
 *         @type int    $interval The schedule interval in seconds.
 *         @type string $display  The schedule display name.
 *     }
 * }
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')), 'weekly' => array('interval' => WEEK_IN_SECONDS, 'display' => __('Once Weekly')));
    /**
     * Filters the non-default cron schedules.
     *
     * @since 2.1.0
     *
     * @param array $new_schedules {
     *     An array of non-default cron schedules keyed by the schedule name. Default empty array.
     *
     *     @type array ...$0 {
     *         Cron schedule information.
     *
     *         @type int    $interval The schedule interval in seconds.
     *         @type string $display  The schedule display name.
     *     }
     * }
     */
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}

WordPress Version: 5.9

/**
 * Retrieve supported event recurrence schedules.
 *
 * The default supported recurrences are 'hourly', 'twicedaily', 'daily', and 'weekly'.
 * A plugin may add more by hooking into the {@see 'cron_schedules'} filter.
 * The filter accepts an array of arrays. The outer array has a key that is the name
 * of the schedule, for example 'monthly'. The value is an array with two keys,
 * one is 'interval' and the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run.
 * So for 'hourly' the time is `HOUR_IN_SECONDS` (60 * 60 or 3600). For 'monthly',
 * the value would be `MONTH_IN_SECONDS` (30 * 24 * 60 * 60 or 2592000).
 *
 * The 'display' is the description. For the 'monthly' key, the 'display'
 * would be `__( 'Once Monthly' )`.
 *
 * For your plugin, you will be passed an array. You can easily add your
 * schedule by doing the following.
 *
 *     // Filter parameter variable name is 'array'.
 *     $array['monthly'] = array(
 *         'interval' => MONTH_IN_SECONDS,
 *         'display'  => __( 'Once Monthly' )
 *     );
 *
 * @since 2.1.0
 * @since 5.4.0 The 'weekly' schedule was added.
 *
 * @return array[]
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')), 'weekly' => array('interval' => WEEK_IN_SECONDS, 'display' => __('Once Weekly')));
    /**
     * Filters the non-default cron schedules.
     *
     * @since 2.1.0
     *
     * @param array[] $new_schedules An array of non-default cron schedule arrays. Default empty.
     */
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}

WordPress Version: 5.4

/**
 * Retrieve supported event recurrence schedules.
 *
 * The default supported recurrences are 'hourly', 'twicedaily', 'daily', and 'weekly'.
 * A plugin may add more by hooking into the {@see 'cron_schedules'} filter.
 * The filter accepts an array of arrays. The outer array has a key that is the name
 * of the schedule, for example 'monthly'. The value is an array with two keys,
 * one is 'interval' and the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run.
 * So for 'hourly' the time is `HOUR_IN_SECONDS` (60 * 60 or 3600). For 'monthly',
 * the value would be `MONTH_IN_SECONDS` (30 * 24 * 60 * 60 or 2592000).
 *
 * The 'display' is the description. For the 'monthly' key, the 'display'
 * would be `__( 'Once Monthly' )`.
 *
 * For your plugin, you will be passed an array. You can easily add your
 * schedule by doing the following.
 *
 *     // Filter parameter variable name is 'array'.
 *     $array['monthly'] = array(
 *         'interval' => MONTH_IN_SECONDS,
 *         'display'  => __( 'Once Monthly' )
 *     );
 *
 * @since 2.1.0
 * @since 5.4.0 The 'weekly' schedule was added.
 *
 * @return array
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')), 'weekly' => array('interval' => WEEK_IN_SECONDS, 'display' => __('Once Weekly')));
    /**
     * Filters the non-default cron schedules.
     *
     * @since 2.1.0
     *
     * @param array $new_schedules An array of non-default cron schedules. Default empty.
     */
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}

WordPress Version: 5.1

/**
 * Retrieve supported event recurrence schedules.
 *
 * The default supported recurrences are 'hourly', 'twicedaily', and 'daily'. A plugin may
 * add more by hooking into the {@see 'cron_schedules'} filter. The filter accepts an array
 * of arrays. The outer array has a key that is the name of the schedule or for
 * example 'weekly'. The value is an array with two keys, one is 'interval' and
 * the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run. So for
 * 'hourly', the time is 3600 or 60*60. For weekly, the value would be
 * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.
 *
 * The 'display' is the description. For the 'weekly' key, the 'display' would
 * be `__( 'Once Weekly' )`.
 *
 * For your plugin, you will be passed an array. you can easily add your
 * schedule by doing the following.
 *
 *     // Filter parameter variable name is 'array'.
 *     $array['weekly'] = array(
 *         'interval' => 604800,
 *         'display'  => __( 'Once Weekly' )
 *     );
 *
 * @since 2.1.0
 *
 * @return array
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')));
    /**
     * Filters the non-default cron schedules.
     *
     * @since 2.1.0
     *
     * @param array $new_schedules An array of non-default cron schedules. Default empty.
     */
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}

WordPress Version: 4.7

/**
 * Retrieve supported event recurrence schedules.
 *
 * The default supported recurrences are 'hourly', 'twicedaily', and 'daily'. A plugin may
 * add more by hooking into the {@see 'cron_schedules'} filter. The filter accepts an array
 * of arrays. The outer array has a key that is the name of the schedule or for
 * example 'weekly'. The value is an array with two keys, one is 'interval' and
 * the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run. So for
 * 'hourly', the time is 3600 or 60*60. For weekly, the value would be
 * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.
 *
 * The 'display' is the description. For the 'weekly' key, the 'display' would
 * be `__( 'Once Weekly' )`.
 *
 * For your plugin, you will be passed an array. you can easily add your
 * schedule by doing the following.
 *
 *     // Filter parameter variable name is 'array'.
 *     $array['weekly'] = array(
 *         'interval' => 604800,
 *     	   'display'  => __( 'Once Weekly' )
 *     );
 *
 *
 * @since 2.1.0
 *
 * @return array
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')));
    /**
     * Filters the non-default cron schedules.
     *
     * @since 2.1.0
     *
     * @param array $new_schedules An array of non-default cron schedules. Default empty.
     */
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}

WordPress Version: 4.6

/**
 * Retrieve supported and filtered Cron recurrences.
 *
 * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by
 * hooking into the {@see 'cron_schedules'} filter. The filter accepts an array of
 * arrays. The outer array has a key that is the name of the schedule or for
 * example 'weekly'. The value is an array with two keys, one is 'interval' and
 * the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run. So for
 * 'hourly', the time is 3600 or 60*60. For weekly, the value would be
 * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.
 *
 * The 'display' is the description. For the 'weekly' key, the 'display' would
 * be `__( 'Once Weekly' )`.
 *
 * For your plugin, you will be passed an array. you can easily add your
 * schedule by doing the following.
 *
 *     // Filter parameter variable name is 'array'.
 *     $array['weekly'] = array(
 *         'interval' => 604800,
 *     	   'display'  => __( 'Once Weekly' )
 *     );
 *
 *
 * @since 2.1.0
 *
 * @return array
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')));
    /**
     * Filters the non-default cron schedules.
     *
     * @since 2.1.0
     *
     * @param array $new_schedules An array of non-default cron schedules. Default empty.
     */
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}

WordPress Version: 4.1

/**
 * Retrieve supported and filtered Cron recurrences.
 *
 * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by
 * hooking into the 'cron_schedules' filter. The filter accepts an array of
 * arrays. The outer array has a key that is the name of the schedule or for
 * example 'weekly'. The value is an array with two keys, one is 'interval' and
 * the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run. So for
 * 'hourly', the time is 3600 or 60*60. For weekly, the value would be
 * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.
 *
 * The 'display' is the description. For the 'weekly' key, the 'display' would
 * be `__( 'Once Weekly' )`.
 *
 * For your plugin, you will be passed an array. you can easily add your
 * schedule by doing the following.
 *
 *     // Filter parameter variable name is 'array'.
 *     $array['weekly'] = array(
 *         'interval' => 604800,
 *     	   'display'  => __( 'Once Weekly' )
 *     );
 *
 *
 * @since 2.1.0
 *
 * @return array
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')));
    /**
     * Filter the non-default cron schedules.
     *
     * @since 2.1.0
     *
     * @param array $new_schedules An array of non-default cron schedules. Default empty.
     */
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}

WordPress Version: 3.8

/**
 * Retrieve supported and filtered Cron recurrences.
 *
 * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by
 * hooking into the 'cron_schedules' filter. The filter accepts an array of
 * arrays. The outer array has a key that is the name of the schedule or for
 * example 'weekly'. The value is an array with two keys, one is 'interval' and
 * the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run. So for
 * 'hourly', the time is 3600 or 60*60. For weekly, the value would be
 * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.
 *
 * The 'display' is the description. For the 'weekly' key, the 'display' would
 * be <code>__('Once Weekly')</code>.
 *
 * For your plugin, you will be passed an array. you can easily add your
 * schedule by doing the following.
 * <code>
 * // filter parameter variable name is 'array'
 *	$array['weekly'] = array(
 *		'interval' => 604800,
 *		'display' => __('Once Weekly')
 *	);
 * </code>
 *
 * @since 2.1.0
 *
 * @return array
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')));
    /**
     * Filter the non-default cron schedules.
     *
     * @since 2.1.0
     *
     * @param array $new_schedules An array of non-default cron schedules. Default empty.
     */
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}

WordPress Version: 3.7

/**
 * Retrieve supported and filtered Cron recurrences.
 *
 * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by
 * hooking into the 'cron_schedules' filter. The filter accepts an array of
 * arrays. The outer array has a key that is the name of the schedule or for
 * example 'weekly'. The value is an array with two keys, one is 'interval' and
 * the other is 'display'.
 *
 * The 'interval' is a number in seconds of when the cron job should run. So for
 * 'hourly', the time is 3600 or 60*60. For weekly, the value would be
 * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.
 *
 * The 'display' is the description. For the 'weekly' key, the 'display' would
 * be <code>__('Once Weekly')</code>.
 *
 * For your plugin, you will be passed an array. you can easily add your
 * schedule by doing the following.
 * <code>
 * // filter parameter variable name is 'array'
 *	$array['weekly'] = array(
 *		'interval' => 604800,
 *		'display' => __('Once Weekly')
 *	);
 * </code>
 *
 * @since 2.1.0
 *
 * @return array
 */
function wp_get_schedules()
{
    $schedules = array('hourly' => array('interval' => HOUR_IN_SECONDS, 'display' => __('Once Hourly')), 'twicedaily' => array('interval' => 12 * HOUR_IN_SECONDS, 'display' => __('Twice Daily')), 'daily' => array('interval' => DAY_IN_SECONDS, 'display' => __('Once Daily')));
    return array_merge(apply_filters('cron_schedules', array()), $schedules);
}