mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-07 09:49:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@25662 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -133,13 +133,19 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
|
||||
$path = '/' . $curcategory->slug . $path;
|
||||
}
|
||||
|
||||
if ( $path == $full_path )
|
||||
return get_category( $category->term_id, $output );
|
||||
if ( $path == $full_path ) {
|
||||
$category = get_term( $category->term_id, 'category', $output );
|
||||
_make_cat_compat( $category );
|
||||
return $category;
|
||||
}
|
||||
}
|
||||
|
||||
// If full matching is not required, return the first cat that matches the leaf.
|
||||
if ( ! $full_match )
|
||||
return get_category( $categories[0]->term_id, $output );
|
||||
if ( ! $full_match ) {
|
||||
$category = get_term( reset( $categories )->term_id, 'category', $output );
|
||||
_make_cat_compat( $category );
|
||||
return $category;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -185,7 +191,7 @@ function get_cat_ID( $cat_name ) {
|
||||
*/
|
||||
function get_cat_name( $cat_id ) {
|
||||
$cat_id = (int) $cat_id;
|
||||
$category = get_category( $cat_id );
|
||||
$category = get_term( $cat_id, 'category' );
|
||||
if ( ! $category || is_wp_error( $category ) )
|
||||
return '';
|
||||
return $category->name;
|
||||
|
||||
Reference in New Issue
Block a user