Warning: Array to string conversion in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 789

Warning: foreach() argument must be of type array|object, string given in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 794

Warning: Array to string conversion in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 789
get_cat_name( int $cat_id )

Retrieves the name of a category from its ID.


Warning: Array to string conversion in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 789

Warning: foreach() argument must be of type array|object, string given in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 794

Warning: Array to string conversion in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 789

Parameters

$cat_id

(Required) Category ID.


Return

(string) Category name, or an empty string if the category doesn't exist.


Source

File: wp-includes/category.php

function get_cat_name( $cat_id ) {
	$cat_id = (int) $cat_id;
	$category = get_term( $cat_id, 'category' );
	if ( ! $category || is_wp_error( $category ) )
		return '';
	return $category->name;
}

Changelog

Changelog
Version Description
1.0.0 Introduced.