Some term caching. see #4189

git-svn-id: https://develop.svn.wordpress.org/trunk@5598 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-05-30 03:36:59 +00:00
parent 18c1cade87
commit 5a8598cd15
3 changed files with 64 additions and 31 deletions
+8 -3
View File
@@ -60,13 +60,15 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
}
function get_the_category($id = false) {
global $post, $category_cache, $blog_id;
global $post, $term_cache, $blog_id;
$id = (int) $id;
if ( !$id )
$id = (int) $post->ID;
$categories = get_object_terms($id, 'category');
$categories = get_post_term_cache($id, 'category');
if ( false === $categories )
$categories = get_object_terms($id, 'category');
if ( !empty($categories) )
usort($categories, '_usort_terms_by_name');
@@ -416,7 +418,10 @@ function get_the_tags( $id = 0 ) {
if ( !$id )
$id = (int) $post->ID;
$tags = wp_get_post_tags( $id );
$tags = get_post_term_cache($id, 'post_tag');
if ( false === $tags )
$tags = get_object_terms($id, 'post_tag');
$tags = apply_filters( 'get_the_tags', $tags );
if ( empty( $tags ) )
return false;