get_linkcatname

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

WordPress Version: 5.5

/**
 * Gets the name of category by ID.
 *
 * @since 0.71
 * @deprecated 2.1.0 Use get_category()
 * @see get_category()
 *
 * @param int $id The category to get. If no category supplied uses 0
 * @return string
 */
function get_linkcatname($id = 0)
{
    _deprecated_function(__FUNCTION__, '2.1.0', 'get_category()');
    $id = (int) $id;
    if (empty($id)) {
        return '';
    }
    $cats = wp_get_link_cats($id);
    if (empty($cats) || !is_array($cats)) {
        return '';
    }
    $cat_id = (int) $cats[0];
    // Take the first cat.
    $cat = get_category($cat_id);
    return $cat->name;
}

WordPress Version: 4.6

/**
 * Gets the name of category by id.
 *
 * @since 0.71
 * @deprecated 2.1.0 Use get_category()
 * @see get_category()
 *
 * @param int $id The category to get. If no category supplied uses 0
 * @return string
 */
function get_linkcatname($id = 0)
{
    _deprecated_function(__FUNCTION__, '2.1.0', 'get_category()');
    $id = (int) $id;
    if (empty($id)) {
        return '';
    }
    $cats = wp_get_link_cats($id);
    if (empty($cats) || !is_array($cats)) {
        return '';
    }
    $cat_id = (int) $cats[0];
    // Take the first cat.
    $cat = get_category($cat_id);
    return $cat->name;
}

WordPress Version: 4.4

/**
 * Gets the name of category by id.
 *
 * @since 0.71
 * @deprecated 2.1.0 Use get_category()
 * @see get_category()
 *
 * @param int $id The category to get. If no category supplied uses 0
 * @return string
 */
function get_linkcatname($id = 0)
{
    _deprecated_function(__FUNCTION__, '2.1', 'get_category()');
    $id = (int) $id;
    if (empty($id)) {
        return '';
    }
    $cats = wp_get_link_cats($id);
    if (empty($cats) || !is_array($cats)) {
        return '';
    }
    $cat_id = (int) $cats[0];
    // Take the first cat.
    $cat = get_category($cat_id);
    return $cat->name;
}

WordPress Version: 3.9

/**
 * Gets the name of category by id.
 *
 * @since 0.71
 * @deprecated 2.1.0
 * @deprecated Use get_category()
 * @see get_category()
 *
 * @param int $id The category to get. If no category supplied uses 0
 * @return string
 */
function get_linkcatname($id = 0)
{
    _deprecated_function(__FUNCTION__, '2.1', 'get_category()');
    $id = (int) $id;
    if (empty($id)) {
        return '';
    }
    $cats = wp_get_link_cats($id);
    if (empty($cats) || !is_array($cats)) {
        return '';
    }
    $cat_id = (int) $cats[0];
    // Take the first cat.
    $cat = get_category($cat_id);
    return $cat->name;
}

WordPress Version: 3.7

/**
 * Gets the name of category by id.
 *
 * @since 0.71
 * @deprecated 2.1
 * @deprecated Use get_category()
 * @see get_category()
 *
 * @param int $id The category to get. If no category supplied uses 0
 * @return string
 */
function get_linkcatname($id = 0)
{
    _deprecated_function(__FUNCTION__, '2.1', 'get_category()');
    $id = (int) $id;
    if (empty($id)) {
        return '';
    }
    $cats = wp_get_link_cats($id);
    if (empty($cats) || !is_array($cats)) {
        return '';
    }
    $cat_id = (int) $cats[0];
    // Take the first cat.
    $cat = get_category($cat_id);
    return $cat->name;
}