Sprache wechseln
wpseek auf Twitter


Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren




get_the_category [ ]

get_the_category ( $id = false )
Parameter:
  • (int) $id Optional, default to current post ID. The post ID.
Nutzt:
  • $post
Gibt zurück:
  • (array)
Definiert in:
Codex



Retrieve post categories.

Quellcode

function get_the_category( $id = false ) {
	$categories = get_the_terms( $id, 'category' );
	if ( ! $categories || is_wp_error( $categories ) )
		$categories = array();

	$categories = array_values( $categories );

	foreach ( array_keys( $categories ) as $key ) {
		_make_cat_compat( $categories[$key] );
	}

	// Filter name is plural because we return alot of categories (possibly more than #13237) not just one
	return apply_filters( 'get_the_categories', $categories );
}

Beispiele [ wp-snippets.com ]

Top Google Suchergebnisse

Mehr ...

0 Nutzerkommentare

Noch keine. Sei der Erste!

Neu hinzufügen ...