update_termmeta_cache()
云策文档标注
概述
update_termmeta_cache() 函数用于更新指定分类法术语ID列表的元数据缓存,通过SQL查询获取元数据并存储,以提高后续get_term_meta()调用的性能。
关键要点
- 函数执行SQL查询以检索匹配$term_ids的所有元数据,并将其存储在缓存中
- 参数$term_ids为必需数组,包含术语ID列表
- 返回成功时为元数据数组,无更新内容时返回false
- 内部调用update_meta_cache()函数实现功能
- 自WordPress 4.4.0版本引入
代码示例
function update_termmeta_cache( $term_ids ) {
return update_meta_cache( 'term', $term_ids );
}
原文内容
Updates metadata cache for list of term IDs.
Description
Performs SQL query to retrieve all metadata for the terms matching $term_ids and stores them in the cache.
Subsequent calls to get_term_meta() will not need to query the database.
Parameters
$term_idsarrayrequired-
List of term IDs.
Source
function update_termmeta_cache( $term_ids ) {
return update_meta_cache( 'term', $term_ids );
}
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |