global_terms()
云策文档标注
概述
global_terms() 函数用于在多站点网络中维护一个全局术语列表,通过同步各博客创建的术语到全局术语表。该函数已在 WordPress 6.1.0 版本中被弃用。
关键要点
- 函数作用:同步当前博客的术语 ID 到全局术语表,返回映射的全局术语 ID。
- 参数:$term_id(必需,当前博客的术语 ID),$deprecated(必需,未使用)。
- 返回值:从全局术语表映射的术语 ID(整数)。
- 状态:自 WordPress 6.1.0 起被弃用,调用时返回原 $term_id 值。
- 相关函数:使用 _deprecated_function() 标记为弃用。
代码示例
function global_terms( $term_id, $deprecated = '' ) {
_deprecated_function( __FUNCTION__, '6.1.0' );
return $term_id;
}注意事项
此函数已弃用,开发者应避免在新代码中使用,并考虑替代方案或直接处理术语 ID。
原文内容
Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.
Parameters
$term_idintrequired-
An ID for a term on the current blog.
$deprecatedstringrequired-
Not used.
Source
function global_terms( $term_id, $deprecated = '' ) {
_deprecated_function( __FUNCTION__, '6.1.0' );
return $term_id;
}