Fetch full terms for the post_category and tags_input queries and then wp_list_pluck() the desired fields. Fetching full terms primes the cache and reduces overall queries. Add cache invalidation to wp_set_post_terms(). Props scribu. see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1062,6 +1062,9 @@ function get_the_terms( $post, $taxonomy ) {
|
||||
if ( ! $post = get_post( $post ) )
|
||||
return false;
|
||||
|
||||
if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) )
|
||||
return false;
|
||||
|
||||
$terms = get_object_term_cache( $post->ID, $taxonomy );
|
||||
if ( false === $terms ) {
|
||||
$terms = wp_get_object_terms( $post->ID, $taxonomy );
|
||||
|
||||
Reference in New Issue
Block a user