WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp get schedule

Description

Retrieve Cron schedule for hook with arguments.

Usage

<?php wp_get_schedule$hook$args ); ?>

Parameters

$hook
(callback) (required) Function or method to call, when cron is run.
Default: None
$args
(array) (optional) Arguments to pass to the hook function.
Default: array

Return Values

(string|boolean) 
False, if no schedule. Schedule on success.

Examples

// If you previously added for example:
// wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'my_hourly_event' );

$schedule = wp_get_schedule( 'my_hourly_event' );

// $schedule == 'hourly'

// Or this if you created something like this:
// wp_schedule_single_event( current_time( 'timestamp' ), 'hourly', 'my_hourly_event', array( 'some_arg' ) );

$schedule = wp_get_schedule( 'my_hourly_event', array( 'some_arg' ) );

// $schedule == 'hourly'

Notes

  • Cron is named after a Unix program which runs unattended scheduled tasks.

Change Log

Since: 2.1.0

Source File

wp_get_schedule() is located in wp-includes/cron.php.

Related

Cron Functions: wp_schedule_event(), wp_schedule_single_event(), wp_clear_scheduled_hook(), wp_next_scheduled(), wp_unschedule_event(), wp_get_schedule()

See also index of Function Reference and index of Template Tags.