Ticket #15407: get_the_category.dry.15407.diff
File get_the_category.dry.15407.diff, 965 bytes (added by , 15 years ago) |
---|
-
wp-includes/category-template.php
64 64 * @return array 65 65 */ 66 66 function get_the_category( $id = false ) { 67 global $post;67 $categories = get_the_terms( $id, 'category' ); 68 68 69 $id = (int) $id;70 if ( !$id )71 $id = (int) $post->ID;72 73 $categories = get_object_term_cache( $id, 'category' );74 if ( false === $categories ) {75 $categories = wp_get_object_terms( $id, 'category' );76 wp_cache_add($id, $categories, 'category_relationships');77 }78 79 if ( !empty( $categories ) )80 usort( $categories, '_usort_terms_by_name' );81 else82 $categories = array();83 84 69 foreach ( (array) array_keys( $categories ) as $key ) { 85 70 _make_cat_compat( $categories[$key] ); 86 71 } 87 88 return $categories;72 73 return apply_filters( 'get_the_categories', $categories ); 89 74 } 90 75 91 76 /**