get_schedule
云策文档标注
概述
get_schedule 是一个 WordPress 过滤器钩子,用于修改或获取特定 Hook 的 cron 任务调度名称。它允许开发者在执行 cron 任务时自定义调度逻辑。
关键要点
- get_schedule 是一个过滤器钩子,用于过滤 Hook 的调度名称。
- 参数包括 $schedule(调度名称或 false)、$hook(要执行的 Action hook)和 $args(传递给回调函数的参数)。
- 通过 apply_filters 调用,返回过滤后的调度名称。
- 与 wp_get_schedule() 函数相关,用于检索事件的重复调度名称。
- 自 WordPress 5.1.0 版本引入。
原文内容
Filters the schedule name for a hook.
Parameters
$schedulestring|false-
Schedule for the hook. False if not found.
$hookstring-
Action hook to execute when cron is run.
$argsarray-
Arguments to pass to the hook’s callback function.
Source
return apply_filters( 'get_schedule', $schedule, $hook, $args );
Changelog
| Version | Description |
|---|---|
| 5.1.0 | Introduced. |