[wp-trac] [WordPress Trac] #18270: get_cat_ID() returns term_id rather than term_taxonomy_id

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 27 18:59:49 UTC 2011


#18270: get_cat_ID() returns term_id rather than term_taxonomy_id
-----------------------------+------------------------------
 Reporter:  GeorgeStephanis  |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Taxonomy         |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------------------
Changes (by scribu):

 * keywords:  reporter-feedback =>


Old description:

> get_the_ID() currently returns the wrong value for a category id.  It's
> giving the term id rather than the term taxonomy id.
>
> As the category ID is the term_taxonomy_id -- I believe that this is just
> legacy code from before the term_id and term_taxonomy_id were separated.
>
> However, if your site is not running a straight 1:1 ratio for term_id =
> term_taxonomy_id (as some aren't) it will not give you the correct
> category id.
>
> Fix:
>
> have it return ->term_taxonomy_id; instead of ->term_id;
>
> -George

New description:

 get_cat_ID() currently returns the wrong value for a category id.  It's
 giving the term id rather than the term taxonomy id.

 As the category ID is the term_taxonomy_id -- I believe that this is just
 legacy code from before the term_id and term_taxonomy_id were separated.

 However, if your site is not running a straight 1:1 ratio for term_id =
 term_taxonomy_id (as some aren't) it will not give you the correct
 category id.

 Fix:

 have it return ->term_taxonomy_id; instead of ->term_id;

 -George

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18270#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list