Ticket #15407: deprecate-get_the_category.15407.diff
File deprecate-get_the_category.15407.diff, 5.6 KB (added by , 13 years ago) |
---|
-
wp-includes/post-template.php
349 349 350 350 // Categories 351 351 if ( is_object_in_taxonomy( $post->post_type, 'category' ) ) { 352 foreach ( (array) get_the_categor y($post->ID) as $cat ) {352 foreach ( (array) get_the_categories($post->ID) as $cat ) { 353 353 if ( empty($cat->slug ) ) 354 354 continue; 355 355 $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID); -
wp-includes/link-template.php
119 119 120 120 $category = ''; 121 121 if ( strpos($permalink, '%category%') !== false ) { 122 $cats = get_the_categor y($post->ID);122 $cats = get_the_categories($post->ID); 123 123 if ( $cats ) { 124 124 usort($cats, '_usort_terms_by_ID'); // order by ID 125 125 $category = $cats[0]->slug; -
wp-includes/deprecated.php
72 72 * 73 73 * @since 0.71 74 74 * @deprecated 0.71 75 * @deprecated use get_the_categor y()76 * @see get_the_categor y()75 * @deprecated use get_the_categories() 76 * @see get_the_categories() 77 77 * 78 78 * @param bool $echo 79 79 * @return null|int 80 80 */ 81 81 function the_category_ID($echo = true) { 82 _deprecated_function( __FUNCTION__, '0.71', 'get_the_categor y()' );82 _deprecated_function( __FUNCTION__, '0.71', 'get_the_categories()' ); 83 83 84 84 // Grab the first cat in the list. 85 $categories = get_the_categor y();85 $categories = get_the_categories(); 86 86 $cat = $categories[0]->term_id; 87 87 88 88 if ( $echo ) … … 108 108 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' ); 109 109 110 110 // Grab the first cat in the list. 111 $categories = get_the_categor y();111 $categories = get_the_categories(); 112 112 $currentcat = $categories[0]->category_id; 113 113 if ( $currentcat != $previouscat ) { 114 114 echo $before; … … 2556 2556 2557 2557 return false; 2558 2558 } 2559 2560 /** 2561 * Retrieve post categories. 2562 * 2563 * @since 0.71 2564 * @uses $post 2565 * @deprecated 3.1 2566 * @deprecated Use get_post_categories() instead. 2567 * 2568 * @param int $id Optional, default to current post ID. The post ID. 2569 * @return array 2570 */ 2571 function get_the_category( $id = false ) { 2572 _deprecated_function( __FUNCTION__, '3.1', 'get_the_categories()' ); 2573 return get_the_categories( $id ); 2574 } -
wp-includes/feed.php
299 299 function get_the_category_rss($type = null) { 300 300 if ( empty($type) ) 301 301 $type = get_default_feed(); 302 $categories = get_the_categor y();302 $categories = get_the_categories(); 303 303 $tags = get_the_tags(); 304 304 $the_list = ''; 305 305 $cat_names = array(); -
wp-includes/category-template.php
57 57 /** 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_categor y( $id = false ) {67 global $post;65 function get_the_categories( $id = false ) { 66 $categories = get_the_terms( $id, 'category' ); 68 67 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 68 foreach ( (array) array_keys( $categories ) as $key ) { 85 69 _make_cat_compat( $categories[$key] ); 86 70 } 87 88 return $categories;71 72 return apply_filters( 'get_the_categories', $categories ); 89 73 } 90 74 91 75 /** … … 155 139 */ 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 ); 161 145 -
wp-content/themes/twentyten/loop.php
141 141 <?php endif; ?> 142 142 143 143 <div class="entry-utility"> 144 <?php if ( count( get_the_categor y() ) ) : ?>144 <?php if ( count( get_the_categories() ) ) : ?> 145 145 <span class="cat-links"> 146 146 <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> 147 147 </span> -
wp-admin/includes/class-wp-posts-list-table.php
596 596 case 'categories': 597 597 ?> 598 598 <td <?php echo $attributes ?>><?php 599 $categories = get_the_categor y();599 $categories = get_the_categories(); 600 600 if ( !empty( $categories ) ) { 601 601 $out = array(); 602 602 foreach ( $categories as $c ) {