[wp-trac] [WordPress Trac] #23109: Inconsistent returned value

WordPress Trac noreply at wordpress.org
Thu Jan 3 11:46:41 UTC 2013


#23109: Inconsistent returned value
-----------------------------+--------------------------
 Reporter:  fp2x             |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:  3.5              |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 I have created a category (its slug is 'misc') with WP 3.4.2.
 I have updated to WP 3.5.

 Now, when I try to get the ID of the 'misc' category created with WP
 3.4.2, I get different results from different functions.
 {{{
     $t=get_category_by_slug( 'misc' );
     echo $t->term_id;// 18
     echo get_cat_ID('misc');// 0 but should be 18
 }}}
 After looking at category.php
 (http://core.trac.wordpress.org/browser/tags/3.5/wp-
 includes/category.php#L0), it seems that the two functions behave
 differently.

 `get_cat_ID` doesn't take avantage of `_make_cat_compat`.

 It may look like this :
 {{{
 function get_cat_ID( $cat_name ) {
    $cat =  get_category_by_slug( $cat_name );
    if ( $cat )
           return $cat->term_id;
    return 0;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23109>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list