wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



get_cat_name › WordPress Function

Da1.0.0
Deprecaton/a
get_cat_name ( $cat_id )
Parametri:
  • (int) $cat_id Category ID.
    Richiesto:
Ritorna:
  • (string) Category name, or an empty string if the category doesn't exist.
Definito a:
Codex:

Retrieves the name of a category from its ID.



Sorgenti

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;
}