Title: wp_get_schedules
Published: April 25, 2014
Last modified: May 20, 2026

---

# wp_get_schedules(): array

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#return)
 * [More Information](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#wp--skip-link--target)

Retrieves supported event recurrence schedules.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#description)󠁿

The default supported recurrences are ‘hourly’, ‘twicedaily’, ‘daily’, and ‘weekly’.

A plugin may add more by hooking into the [‘cron_schedules’](https://developer.wordpress.org/reference/hooks/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 add your schedule by doing
the following:

    ```php
    // Filter parameter variable name is 'array'.
    $array['monthly'] = array(
        'interval' => MONTH_IN_SECONDS,
        'display'  => __( 'Once Monthly' )
    );
    ```

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#return)󠁿

 array The array of cron schedules keyed by the schedule name.

 * `...$0` array
 *  Cron schedule information.
    - `interval` int
    - The schedule interval in seconds.
    - `display` string
    - The schedule display name.

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#more-information)󠁿

Example Return Values:

    ```php
    Array
    (
    [hourly] => Array
    (
    [interval] => 3600
    [display] => Once Hourly
    )
    [twicedaily] => Array
    (
    [interval] => 43200
    [display] => Twice Daily
    )
    [daily] => Array
    (
    [interval] => 86400
    [display] => Once Daily
    )
    )
    ```

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#source)󠁿

    ```php
    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 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/cron.php#L1131)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/cron.php#L1131-L1168)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#hooks)󠁿

 [apply_filters( ‘cron_schedules’, array $new_schedules )](https://developer.wordpress.org/reference/hooks/cron_schedules/)

Filters the non-default cron schedules.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#related)󠁿

| Uses | Description | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [_wp_cron()](https://developer.wordpress.org/reference/functions/_wp_cron/)`wp-includes/cron.php` |

Runs scheduled callbacks or spawns cron for all scheduled events.

  | 
| [WP_Site_Health::wp_schedule_test_init()](https://developer.wordpress.org/reference/classes/wp_site_health/wp_schedule_test_init/)`wp-admin/includes/class-wp-site-health.php` |

Initiates the WP_Cron schedule test cases.

  | 
| [wp_schedule_event()](https://developer.wordpress.org/reference/functions/wp_schedule_event/)`wp-includes/cron.php` |

Schedules a recurring event.

  | 
| [wp_reschedule_event()](https://developer.wordpress.org/reference/functions/wp_reschedule_event/)`wp-includes/cron.php` |

Reschedules a recurring event.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | The `'weekly'` schedule was added. | 
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/wp_get_schedules/?output_format=md#comment-content-1077)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/wp_get_schedules/#comment-1077)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_get_schedules%2F%23comment-1077)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_get_schedules%2F%23comment-1077)
 4. **Basic Example**
     The ‘display’ is the description. For the ‘weekly’ key, the ‘
    display’ would be
 5.     ```php
        __( 'Once Weekly' );
        ```
    
 6. For your plugin, you will be passed an array. You can easily add a new interval
    schedule by doing the following using the ‘cron_schedules’ filter.
 7.     ```php
         add_filter( 'cron_schedules', 'cron_add_weekly' );
    
         function cron_add_weekly( $schedules ) {
         	// Adds once weekly to the existing schedules.
         	$schedules['weekly'] = array(
         		'interval' => 604800,
         		'display' => __( 'Once Weekly' )
         	);
         	return $schedules;
         }
        ```
    
 8.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_get_schedules%2F%3Freplytocom%3D1077%23feedback-editor-1077)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_get_schedules%2F)
before being able to contribute a note or feedback.