On this page
wp_get_link_cats( int $link_id ): int[]
Retrieves the link category IDs associated with the link specified.
Parameters
$link_idint Required-
Link ID to look up.
Return
int[] The IDs of the requested link's categories.
Source
File: wp-admin/includes/bookmark.php. View all references
function wp_get_link_cats( $link_id = 0 ) {
$cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) );
return array_unique( $cats );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_get_object_terms() wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
Used By
| Used By | Description |
|---|---|
| WP_Links_List_Table::display_rows() wp-admin/includes/class-wp-links-list-table.php | |
| wp_link_category_checklist() wp-admin/includes/template.php | Outputs a link category checklist element. |
| get_linkcatname() wp-includes/deprecated.php | Gets the name of category by ID. |
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_get_link_cats