Make WordPress Core

Changeset 25662


Ignore:
Timestamp:
10/02/2013 07:58:50 PM (11 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.

Location:
trunk/src
Files:
4 edited

Legend:

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

    r23563 r25662  
    3535 */
    3636function get_category_to_edit( $id ) {
    37     $category = get_category( $id, OBJECT, 'edit' );
     37    $category = get_term( $id, 'category', OBJECT, 'edit' );
     38    _make_cat_compat( $category );
    3839    return $category;
    3940}
     
    156157
    157158    // First, get all of the original fields
    158     $category = get_category($cat_ID, ARRAY_A);
     159    $category = get_term( $cat_ID, 'category', ARRAY_A );
     160    _make_cat_compat( $category );
    159161
    160162    // Escape data pulled from DB.
  • trunk/src/wp-includes/category-template.php

    r25641 r25662  
    4242function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
    4343    $chain = '';
    44     $parent = get_category( $id );
     44    $parent = get_term( $id, 'category' );
    4545    if ( is_wp_error( $parent ) )
    4646        return $parent;
     
    136136function get_the_category_by_ID( $cat_ID ) {
    137137    $cat_ID = (int) $cat_ID;
    138     $category = get_category( $cat_ID );
     138    $category = get_term( $cat_ID, 'category' );
    139139    if ( is_wp_error( $category ) )
    140140        return $category;
  • 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 '';
  • trunk/src/wp-includes/link-template.php

    r25570 r25662  
    132132            // having to assign it explicitly
    133133            if ( empty($category) ) {
    134                 $default_category = get_category( get_option( 'default_category' ) );
     134                $default_category = get_term( get_option( 'default_category' ), 'category' );
    135135                $category = is_wp_error( $default_category ) ? '' : $default_category->slug;
    136136            }
Note: See TracChangeset for help on using the changeset viewer.