Populate post term relationship cache in get_the_terms(). Restores caching lost when we moved away from get_the_category(). see #15407

git-svn-id: https://develop.svn.wordpress.org/trunk@16487 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2010-11-19 17:09:21 +00:00
parent 90e783e1fe
commit 8ff8013fe7
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -1066,9 +1066,11 @@ function get_the_terms( $id = 0, $taxonomy ) {
}
$terms = get_object_term_cache( $id, $taxonomy );
if ( false === $terms )
if ( false === $terms ) {
$terms = wp_get_object_terms( $id, $taxonomy );
wp_cache_add($id, $terms, $taxonomy . '_relationships');
}
$terms = apply_filters( 'get_the_terms', $terms, $id, $taxonomy );
if ( empty( $terms ) )