[wp-trac] [WordPress Trac] #15442: Indexes no longer start at 0 for get_the_category()
WordPress Trac
wp-trac at lists.automattic.com
Tue Nov 16 17:21:24 UTC 2010
#15442: Indexes no longer start at 0 for get_the_category()
--------------------------+-------------------------------------------------
Reporter: ramenboy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.1
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
Due to changes related to #15407, it seems that the keys in the array
returned by get_the_category() are now category IDs instead of being
0-based. As a result, code such as the following now breaks:
<?php
$category = get_the_category();
echo $category[0]->cat_name;
?>
The above usage is from the docs:
http://codex.wordpress.org/Function_Reference/get_the_category
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15442>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list