wp_load_speculation_rules
云策文档标注
概述
wp_load_speculation_rules 是一个 WordPress 动作钩子,在推测规则数据加载时触发,允许开发者修改这些规则。它主要用于自定义推测加载行为。
关键要点
- 这是一个动作钩子,用于在推测规则数据加载时执行自定义代码。
- 参数 $speculation_rules 是一个 WP_Speculation_Rules 对象,代表要使用的推测规则。
- 相关函数 wp_get_speculation_rules() 用于获取基于配置的完整推测规则数据。
- 该钩子从 WordPress 6.8.0 版本开始引入。
代码示例
do_action( 'wp_load_speculation_rules', $speculation_rules );
原文内容
Fires when speculation rules data is loaded, allowing to amend the rules.
Parameters
$speculation_rulesWP_Speculation_Rules-
Object representing the speculation rules to use.
Source
do_action( 'wp_load_speculation_rules', $speculation_rules );
Changelog
| Version | Description |
|---|---|
| 6.8.0 | Introduced. |