On this page
get_linkcatname( int $id ): string
This function has been deprecated. Use get_category() instead.
Gets the name of category by ID.
Description
See also
Parameters
$idint Required-
The category to get. If no category supplied uses 0
Return
string
Source
File: wp-includes/deprecated.php. View all references
function get_linkcatname($id = 0) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' );
$id = (int) $id;
if ( empty($id) )
return '';
$cats = wp_get_link_cats($id);
if ( empty($cats) || ! is_array($cats) )
return '';
$cat_id = (int) $cats[0]; // Take the first cat.
$cat = get_category($cat_id);
return $cat->name;
}
Related
Uses
| Uses | Description |
|---|---|
| wp_get_link_cats() wp-admin/includes/bookmark.php | Retrieves the link category IDs associated with the link specified. |
| get_category() wp-includes/category.php | Retrieves category data given a category ID or category object. |
| _deprecated_function() wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Use get_category() |
| 0.71 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_linkcatname