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

Contents

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

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.