get_all_category_ids()WP 2.0.0

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

Retrieves all category IDs.

No Hooks.

Return

Int[]. List of all of the category IDs.

Usage

get_all_category_ids();

Examples

0

#1 Display the list of category IDs and their names, in the format identifier:name

$category_ids = get_all_category_ids();

foreach( $category_ids as $cat_id ){

	$cat_name = get_cat_name( $cat_id );

	echo "{$cat_id}: {$cat_name}<br />";
}

Notes

Changelog

Since 2.0.0 Introduced.
Deprecated since 4.0.0 Use get_terms()

get_all_category_ids() code WP 6.6.2

function get_all_category_ids() {
	_deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' );

	$cat_ids = get_terms(
		array(
			'taxonomy' => 'category',
			'fields'   => 'ids',
			'get'      => 'all',
		)
	);

	return $cat_ids;
}