get_cat_name

Definition:
function get_cat_name( $cat_id ) {}

Retrieve the name of a category from its ID.

Parameters

  • int $cat_id: Category ID

Return values

returns:Category name, or an empty string if category doesn’t exist.

Source code

function get_cat_name( $cat_id ) {

	$cat_id = (int) $cat_id;

	$category = &get_category( $cat_id );

	if ( ! $category || is_wp_error( $category ) )

		return '';

	return $category->name;

}

1266

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: