get_linkcatname

Definition:
function get_linkcatname($id = 0) {}

Gets the name of category by id.

Parameters

  • int $id: The category to get. If no category supplied uses 0

Source code

function get_linkcatname($id = 0) {

	_deprecated_function( __FUNCTION__, '2.1', '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;

}

1449

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: