get_category_link

The timeline below displays how wordpress function get_category_link has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Taxonomy API: Core category-specific template tags
 *
 * @package WordPress
 * @subpackage Template
 * @since 1.2.0
 */
/**
 * Retrieves 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);
    if (is_wp_error($category)) {
        return '';
    }
    return $category;
}

WordPress Version: .10

/**
 * 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);
    if (is_wp_error($category)) {
        return '';
    }
    return $category;
}

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;
}

WordPress Version: 3.7

/**
 * Category Template Tags and API.
 *
 * @package WordPress
 * @subpackage Template
 */
/**
 * 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;
}