Changeset 16332 for trunk/wp-includes/category-template.php
- Timestamp:
- 11/12/2010 08:05:37 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r16331 r16332 58 58 * Retrieve post categories. 59 59 * 60 * @since 0.71 61 * @uses $post 60 * @since 3.1 62 61 * 63 62 * @param int $id Optional, default to current post ID. The post ID. 64 63 * @return array 65 64 */ 66 function get_the_category( $id = false ) { 67 global $post; 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 else 82 $categories = array(); 65 function get_the_categories( $id = false ) { 66 $categories = get_the_terms( $id, 'category' ); 83 67 84 68 foreach ( (array) array_keys( $categories ) as $key ) { … … 86 70 } 87 71 88 return $categories;72 return apply_filters( 'get_the_categories', $categories ); 89 73 } 90 74 … … 156 140 function get_the_category_list( $separator = '', $parents='', $post_id = false ) { 157 141 global $wp_rewrite; 158 $categories = get_the_categor y( $post_id );142 $categories = get_the_categories( $post_id ); 159 143 if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) 160 144 return apply_filters( 'the_category', '', $separator, $parents );
Note: See TracChangeset
for help on using the changeset viewer.