wp_get_link_cats() WordPress Function

The wp_get_link_cats() function is used to get the link category objects associated with a link.

wp_get_link_cats( int $link_id ) #

Retrieves the link category IDs associated with the link specified.


Parameters

$link_id

(int)(Required)Link ID to look up.


Top ↑

Return

(int[]) The IDs of the requested link's categories.


Top ↑

Source

File: wp-admin/includes/bookmark.php

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


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.