按id获取类别的名称。
原型
get_linkcatname( int $id )
参数
$id
(int)
(Required)
得到的类别。如果没有提供的类别使用0
返回值
(string)
源文件
路径:wp-includes/deprecated.php
<?php
...
function get_linkcatname($id = 0) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' );
$id = (int) $id;
if ( empty($id) )
return '';
$cats = wp_get_link_cats($id);
if ( empty($cats) || ! is_array($cats) )
return '';
$cat_id = (int) $cats[0]; // Take the first cat.
$cat = get_category($cat_id);
return $cat->name;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_linkcatname/