WordPress开发者和主题制作者的搜索引擎



get_category_link ›

Since1.0.0
已弃用n/a
get_category_link ( $category )
参数:
  • (int|object) $category Category ID or object.
    Required: Yes
查看:
返回:
  • (string) Link on success, empty string if category does not exist.
定义在:
文档:

Retrieve category link URL.



源码

function get_category_link( $category ) {
	if ( ! is_object( $category ) ) {
		$category = (int) $category;
	}

	$category = get_term_link( $category );

	if ( is_wp_error( $category ) ) {
		return '';
	}

	return $category;
}