钩子文档

set_site_transient_{$transient}

💡 云策文档标注

概述

这是一个 WordPress 动态 Hook,在设置特定站点瞬态值后触发。开发者可以利用此 Hook 在瞬态值更新时执行自定义操作。

关键要点

  • Hook 名称是动态的,基于瞬态名称($transient)构建,例如 set_site_transient_my_transient。
  • 传递三个参数:$value(瞬态值)、$expiration(过期时间,以秒为单位)和 $transient(瞬态名称)。
  • 与 set_site_transient() 函数关联,用于在站点瞬态设置后执行额外逻辑。
  • 自 WordPress 3.0.0 引入,4.4.0 版本添加了 $transient 参数。

📄 原文内容

Fires after the value for a specific site transient has been set.

Description

The dynamic portion of the hook name, $transient, refers to the transient name.

Parameters

$valuemixed
Site transient value.
$expirationint
Time until expiration in seconds.
$transientstring
Transient name.

Source

do_action( "set_site_transient_{$transient}", $value, $expiration, $transient );

Changelog

Version Description
4.4.0 The $transient parameter was added
3.0.0 Introduced.