get_the_category

Definition:
function get_the_category( $id = false ) {}

Retrieve post categories.

Parameters

  • int $id: Optional, default to current post ID. The post ID.

Defined filters

  • get_the_categories
    apply_filters( 'get_the_categories', $categories )

Source code

function get_the_category( $id = false ) {

	$categories = get_the_terms( $id, 'category' );

	if ( ! $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 );

}

1815

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: