Update object term cache from get_the_category()
git-svn-id: http://svn.automattic.com/wordpress/trunk@9885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c763a657d8
commit
7f14907c42
|
@ -125,8 +125,10 @@ function get_the_category( $id = false ) {
|
|||
$id = (int) $post->ID;
|
||||
|
||||
$categories = get_object_term_cache( $id, 'category' );
|
||||
if ( false === $categories )
|
||||
if ( false === $categories ) {
|
||||
$categories = wp_get_object_terms( $id, 'category' );
|
||||
wp_cache_add($post->ID, $categories, 'category_relationships');
|
||||
}
|
||||
|
||||
if ( !empty( $categories ) )
|
||||
usort( $categories, '_usort_terms_by_name' );
|
||||
|
|
Loading…
Reference in New Issue