Un motore di ricerca WordPress per sviluppatori e autori di temi



get_the_category_by_id ›

Da0.71
Deprecaton/a
get_the_category_by_id ( $cat_ID )
Parametri:
  • (int) $cat_ID Category ID.
    Richiesto:
Ritorna:
  • (string|WP_Error) Category name on success, WP_Error on failure.
Definito a:
Codex:

Retrieve category name based on category ID.



Sorgenti

function get_the_category_by_ID( $cat_ID ) {
	$cat_ID   = (int) $cat_ID;
	$category = get_term( $cat_ID );

	if ( is_wp_error( $category ) ) {
		return $category;
	}

	return ( $category ) ? $category->name : '';
}