Codex

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.

This page redirects to an external site: https://developer.wordpress.org/reference/functions/get_all_category_ids/

Description

Retrieves all category IDs.

Usage

<code style="color: #000000"><span style="color: #0000BB"><?php get_all_category_ids</span><span style="color: #007700">() </span><span style="color: #0000BB">?></span></code>

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.