sync_category_tag_slugs()
云策文档标注
概述
sync_category_tag_slugs() 是一个已弃用的 WordPress 函数,用于在启用全局术语时同步分类和文章标签的 slugs。该函数自 WordPress 6.1.0 版本起被标记为弃用,开发者应避免使用。
关键要点
- 函数作用:当全局术语启用时,同步分类和文章标签的 slugs。
- 弃用状态:自 WordPress 6.1.0 版本起弃用,使用 _deprecated_function() 标记。
- 参数:接受 $term(WP_Term 或数组)和 $taxonomy(字符串)两个必需参数。
- 返回值:始终返回传入的 $term 参数。
- 历史版本:在 WordPress 3.0.0 中引入,6.1.0 中弃用。
代码示例
function sync_category_tag_slugs( $term, $taxonomy ) {
_deprecated_function( __FUNCTION__, '6.1.0' );
return $term;
}注意事项
由于此函数已弃用,开发者应寻找替代方案或更新代码以避免依赖它,以保持兼容性和最佳实践。
原文内容
Synchronizes category and post tag slugs when global terms are enabled.
Parameters
$termWP_Term|arrayrequired-
The term.
$taxonomystringrequired-
The taxonomy for
$term.
Source
function sync_category_tag_slugs( $term, $taxonomy ) {
_deprecated_function( __FUNCTION__, '6.1.0' );
return $term;
}