函数文档

is_taxonomy()

💡 云策文档标注

概述

is_taxonomy() 函数用于检查指定的分类法名称是否存在,但自 WordPress 3.0.0 起已被弃用,建议使用 taxonomy_exists() 替代。

关键要点

  • 函数 is_taxonomy() 接受一个字符串参数 $taxonomy,表示分类法名称,返回布尔值指示该分类法是否存在。
  • 自 WordPress 3.0.0 版本起,此函数已被弃用,内部调用 _deprecated_function() 并重定向到 taxonomy_exists()。
  • 相关函数包括 taxonomy_exists()(用于替代)和 _deprecated_function()(用于标记弃用)。
  • 版本历史:在 2.3.0 引入,3.0.0 弃用。
  • 用户贡献笔记提示:检查当前页面是否为自定义分类法归档页面应使用 is_tax() 函数。

📄 原文内容

Checks that the taxonomy name exists.

Description

See also

Parameters

$taxonomystringrequired
Name of taxonomy object

Return

bool Whether the taxonomy exists.

Source

function is_taxonomy( $taxonomy ) {
	_deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' );
	return taxonomy_exists( $taxonomy );
}

Changelog

Version Description
3.0.0 Deprecated. Use taxonomy_exists()
2.3.0 Introduced.

User Contributed Notes