wp-content/uploads/20200520_5ec41476ee377.jpg" alt="get="_blank">wordpress主题函数get_the_category 标签的文章" target="_blank">category_by_id()知识点" >
WordPress主题函数get_the_category_by_ID()知识点。
描述:
通过分类id获取分类所有信息
用法:
<?php get_the_category_by_ID( $cat_ID ); ?>
参数:
$cat_ID
默认值:None
源文件:
/** * Retrieve category name based on category ID. * * @since 0.71 * * @param int $cat_ID Category ID. * @return string|WP_error Category name on success, WP_Error on failure. */ function get_the_category_by_ID( $cat_ID ) { $cat_ID = (int) $cat_ID; $category = get_term( $cat_ID, 'category' ); if ( is_wp_error( $category ) ) return $category; return ( $category ) ? $category->name : ''; }

博悦天下










