wp_get_schedule()
Retrieves the name of the recurrence schedule for an event.
Хуки из функции
Возвращает
Строку|false. Schedule name on success, false if no schedule.
Использование
wp_get_schedule( $hook, $args );
- $hook(строка) (обязательный)
- Action hook to identify the event.
- $args(массив)
- Arguments passed to the event's callback function.
По умолчанию: empty array
Заметки
- Смотрите: wp_get_schedules() for available schedules.
Список изменений
| С версии 2.1.0 | Введена. |
| С версии 5.1.0 | get_schedule filter added. |
Код wp_get_schedule() wp get schedule WP 6.9
function wp_get_schedule( $hook, $args = array() ) {
$schedule = false;
$event = wp_get_scheduled_event( $hook, $args );
if ( $event ) {
$schedule = $event->schedule;
}
/**
* Filters the schedule name for a hook.
*
* @since 5.1.0
*
* @param string|false $schedule Schedule for the hook. False if not found.
* @param string $hook Action hook to execute when cron is run.
* @param array $args Arguments to pass to the hook's callback function.
*/
return apply_filters( 'get_schedule', $schedule, $hook, $args );
}