WordPress at a glance
function is not described

the_category_ID() WP 0.71

Deprecated from version 0.7. It is no longer supported and can be removed in future releases. Use get_the_category() instead.

Returns or prints a category ID.

No Hooks.


Int. Category ID.


the_category_ID( $echo );
Whether to echo the output.
Default: true


  • See: get_the_category()


Since 0.71 Introduced.
Deprecated Since 0.71 Use get_the_category()

Code of the_category_ID() WP 5.7

function the_category_ID($echo = true) {
	_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );

	// Grab the first cat in the list.
	$categories = get_the_category();
	$cat = $categories[0]->term_id;

	if ( $echo )
		echo $cat;

	return $cat;