WP CLI说明文档

wp transient pluck

命令概述

从指定的 WordPress 临时数据(transient)值中,根据提供的键路径提取并返回对应的值。

适用于需要从复杂的临时数据结构中获取特定字段的场景。

参数列表

参数 说明
<key> 临时数据的键。
<key-path>… 值中要定位提取值的键名。
[--format=<format>] 输出格式。默认:plaintext。选项:plaintext、json、yaml。
[--network] 获取网络或站点级临时数据的值。在单站点中,这是一个特殊命名的缓存键;在多站点中,这是一个全局缓存(而非站点本地缓存)。

常用示例

从临时数据中提取值

$ wp transient pluck my_transient nested_key

以 JSON 格式输出提取的值

$ wp transient pluck my_transient nested_key --format=json