钩子文档

pre_get_ready_cron_jobs

💡 云策文档标注

概述

pre_get_ready_cron_jobs 是一个 WordPress 过滤器,用于覆盖检索准备就绪的 cron 作业的过程。通过返回一个数组,可以绕过默认的 cron 作业获取逻辑,直接使用过滤后的值。

关键要点

  • 这是一个过滤器,允许开发者自定义返回准备就绪的 cron 作业数组。
  • 参数 $pre 默认为 null,如果设置为数组,将替代从 _get_cron_array() 获取的结果。
  • 该过滤器在 wp_get_ready_cron_jobs() 函数中被调用,用于检索即将运行的 cron 作业。
  • 自 WordPress 5.1.0 版本引入。

📄 原文内容

Filter to override retrieving ready cron jobs.

Description

Returning an array will short-circuit the normal retrieval of ready cron jobs, causing the function to return the filtered value instead.

Parameters

$prenull|array[]
Array of ready cron tasks to return instead. Default null to continue using results from _get_cron_array() .

Source

$pre = apply_filters( 'pre_get_ready_cron_jobs', null );

Changelog

Version Description
5.1.0 Introduced.