wp_get_link_cats( int $link_id ): int[]

In this article

Retrieves the link category IDs associated with the link specified.

Parameters

$link_idintrequired
Link ID to look up.

Return

int[] The IDs of the requested link’s categories.

Source

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

Changelog

VersionDescription
2.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.