WordPress Version: 4.4
/**
* Taxonomy API: Core category-specific template tags
*
* @package WordPress
* @subpackage Template
* @since 1.2.0
*/
/**
* Retrieve category link URL.
*
* @since 1.0.0
* @see get_term_link()
*
* @param int|object $category Category ID or object.
* @return string Link on success, empty string if category does not exist.
*/
function get_category_link($category)
{
if (!is_object($category)) {
$category = (int) $category;
}
$category = get_term_link($category, 'category');
if (is_wp_error($category)) {
return '';
}
return $category;
}