Wordpress uses category_cache global variable to cache categories by posts. This means that it can be queried for categories by providing the post ID. It is a two-dimensional array set in the function update_post_category_cache($post_ids) defined in [wordpress root folder]/wp-includes/functions.php.
The cache can improve performance by saving repeated trips to the database for querying the same data.
Wordpress uses category_cache internally in the following functions:
get_the_category($post_id = false): returns categories the specified post is classified under. An array of the categories is returned.in_category($category): tells whether the current post is in the specified category or not.
Back to full list of global variables.
Technorati tags: category_cache


May 22nd, 2006 at 8:32 am
[...] category_cache [...]
May 24th, 2006 at 2:34 pm
[...] $category_cache [...]