Make WordPress Core


Ignore:
Timestamp:
10/02/2013 07:58:50 PM (13 years ago)
Author:
wonderboymusic
Message:

Rather than adding a taxonomy arg to get_category(), convert all uses of get_category() in core to get_term(). By doing so, we negate the need to call _make_cat_compat() in a few places that are only looking for a single property.

Fixes #8722.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/category.php

    r22634 r25662  
    134134                }
    135135
    136                 if ( $path == $full_path )
    137                         return get_category( $category->term_id, $output );
     136                if ( $path == $full_path ) {
     137                        $category = get_term( $category->term_id, 'category', $output );
     138                        _make_cat_compat( $category );
     139                        return $category;
     140                }
    138141        }
    139142
    140143        // If full matching is not required, return the first cat that matches the leaf.
    141         if ( ! $full_match )
    142                 return get_category( $categories[0]->term_id, $output );
     144        if ( ! $full_match ) {
     145                $category = get_term( reset( $categories )->term_id, 'category', $output );
     146                _make_cat_compat( $category );
     147                return $category;
     148        }
    143149
    144150        return null;
    … …  
    186192function get_cat_name( $cat_id ) {
    187193        $cat_id = (int) $cat_id;
    188         $category = get_category( $cat_id );
     194        $category = get_term( $cat_id, 'category' );
    189195        if ( ! $category || is_wp_error( $category ) )
    190196                return '';
Note: See TracChangeset for help on using the changeset viewer.