wp_get_link_cats

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

WordPress Version: 5.4

/**
 * Retrieves the link category IDs associated with the link specified.
 *
 * @since 2.1.0
 *
 * @param int $link_id Link ID to look up.
 * @return int[] The IDs of the requested link's categories.
 */
function wp_get_link_cats($link_id = 0)
{
    $cats = wp_get_object_terms($link_id, 'link_category', array('fields' => 'ids'));
    return array_unique($cats);
}

WordPress Version: 3.7

/**
 * Retrieves the link categories associated with the link specified.
 *
 * @since 2.1.0
 *
 * @param int $link_id Link ID to look up
 * @return array The requested link's categories
 */
function wp_get_link_cats($link_id = 0)
{
    $cats = wp_get_object_terms($link_id, 'link_category', array('fields' => 'ids'));
    return array_unique($cats);
}