WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get all category ids


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use get_terms instead.

Description

Retrieves all category IDs.

Usage

<?php get_all_category_ids() ?>

Parameters

None.

Return Values

(array) 
A list of all of the category IDs.

Examples

To print a list of categories by id: name

<?php
$category_ids = get_all_category_ids();
foreach($category_ids as $cat_id) {
  $cat_name = get_cat_name($cat_id);
  echo $cat_id . ': ' . $cat_name;
}
?>

Notes

Change Log

Since: 2.0.0 Deprecated: 4.0.0

Source File

get_all_category_ids() is located in wp-includes/category.php.

Related

See also index of Function Reference and index of Template Tags.