Ticket #10277: category.php.r12462.diff
| File category.php.r12462.diff, 847 bytes (added by , 16 years ago) |
|---|
-
trunk/wp-includes/category.php
a b 175 175 /** 176 176 * Retrieve the name of a category from its ID. 177 177 * 178 178 * @since 1.0.0 179 179 * 180 180 * @param int $cat_id Category ID 181 181 * @return string Category name 182 182 */ 183 183 function get_cat_name( $cat_id ) { 184 184 $cat_id = (int) $cat_id; 185 185 $category = &get_category( $cat_id ); 186 186 return $category->name; 187 187 } 188 188 189 function get_category_root($cat_id = 0) { 190 $category_parent = get_category($cat_id); 191 while( ! empty( $category_parent->category_parent ) ) { 192 $category_parent = get_category($category_parent->category_parent); 193 } 194 return ! empty( $category_parent->term_id ) ? $category_parent->term_id : $cat_id; 195 }