wp_get_link_cats()WP 2.1.0

Retrieves the link category IDs associated with the link specified.

No Hooks.

Return

Int[]. The IDs of the requested link's categories.

Usage

wp_get_link_cats( $link_id );
$link_id(int)
Link ID to look up.

Changelog

Since 2.1.0 Introduced.

wp_get_link_cats() code WP 6.5.2

function wp_get_link_cats( $link_id = 0 ) {
	$cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) );
	return array_unique( $cats );
}