返回或打印类别ID。
原型
the_category_ID( bool $echo = true )
参数
$echo
(bool)
(Optional)
是否回显输出。
返回值
(int)
类别ID。
源文件
路径:wp-includes/deprecated.php
<?php
...
function the_category_ID($echo = true) {
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
// Grab the first cat in the list.
$categories = get_the_category();
$cat = $categories[0]->term_id;
if ( $echo )
echo $cat;
return $cat;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/the_category_id/