mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user