wp_get_link_cats()
Retrieves the link category IDs associated with the link specified.
No Hooks.
Returns
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() wp get link cats code WP 6.9
function wp_get_link_cats( $link_id = 0 ) {
$cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) );
return array_unique( $cats );
}