get_taxonomy()
get_taxonomy( string $taxonomy ) 检索$taxonomy的分类对象。Retri…
get_taxonomy( string $taxonomy )
检索$taxonomy的分类对象。
Retrieves the taxonomy object of $taxonomy.
检索$taxonomy的分类对象。
Retrieves the taxonomy object of $taxonomy.
目录锚点:#说明#参数#返回#源码#笔记
说明(Description)
get_taxonomy函数将首先检查给定的参数字符串是否是分类对象,如果是,它将返回它。
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $taxonomy | (string) | 必需 | 要返回的分类对象的名称。 |
返回(Return)
(WP|Taxonomy|false)分类对象,如果$Taxonomy不存在,则为false。
源码(Source)
/**
* Retrieves the taxonomy object of $taxonomy.
*
* The get_taxonomy function will first check that the parameter string given
* is a taxonomy object and if it is, it will return it.
*
* @since 2.3.0
*
* @global array $wp_taxonomies The registered taxonomies.
*
* @param string $taxonomy Name of taxonomy object to return.
* @return object|false The Taxonomy Object or false if $taxonomy doesn't exist.
*/
function get_taxonomy( $taxonomy ) {
global $wp_taxonomies;
if ( ! taxonomy_exists( $taxonomy ) )
return false;
return $wp_taxonomies[$taxonomy];
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.3.0 | wp-includes/taxonomy.php:261 | 77 | 1 function |
笔记(Notes)
例如,与名为“rentals”的自定义post类型关联的名为“features”的自定义分类法。
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!