Update object term cache from get_the_category()
git-svn-id: https://develop.svn.wordpress.org/trunk@9885 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3d6cfe8255
commit
351a57e3ba
@ -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…
x
Reference in New Issue
Block a user