transient_{$transient}
云策文档标注
概述
此文档介绍 WordPress 中的 transient_{$transient} 过滤器钩子,用于过滤现有瞬态(transient)的值。钩子名称的动态部分 $transient 指代瞬态名称。
关键要点
- transient_{$transient} 是一个过滤器钩子,允许开发者在获取瞬态值时修改其值。
- 钩子接受两个参数:$value(瞬态的原始值)和 $transient(瞬态名称)。
- 此钩子与 get_transient() 函数相关,用于在检索瞬态值时应用过滤。
- 从 WordPress 4.4.0 版本开始,添加了 $transient 参数;钩子最初在 2.8.0 版本引入。
原文内容
Filters an existing transient’s value.
Description
The dynamic portion of the hook name, $transient, refers to the transient name.
Parameters
$valuemixed-
Value of transient.
$transientstring-
Transient name.
Source
return apply_filters( "transient_{$transient}", $value, $transient );