[wp-hackers] Obtaining category id from new permalinks system

Kaf Oseo kaf at szub.net
Tue Jan 3 18:15:20 GMT 2006

Denis de Bernardy wrote:
> This thingy was discussed a little earlier in the list. Could be what you're
> looking for:
> $GLOBALS['wp_object_cache']->cache['category'][$cat]

I suggested that, but figured out another (purely WP) way:

global $wp_query;
$current_cat = $wp_query->get_queried_object_id();

You can also glean all of the category table data into an array

$category = $wp_query->get_queried_object();


More information about the wp-hackers mailing list