wp_get_link_cats

Retrieves the link categories associated with the link specified.

Description

(array) wp_get_link_cats( (int) $link_id = 0 ); 

Returns (array)

The requested link's categories

Parameters (1)

0. $link_id — Optional. (int)
Link ID to look up

Usage

  1. if ( !function_exists( 'wp_get_link_cats' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/bookmark.php'; 
  3.  
  4. // Link ID to look up 
  5. $link_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_get_link_cats($link_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/bookmark.php  
  1. function wp_get_link_cats( $link_id = 0 ) { 
  2. $cats = wp_get_object_terms( $link_id, 'link_category', array('fields' => 'ids') ); 
  3. return array_unique( $cats );