From fb2d04d68e9774d0242ede8565d60e1d0ea50173 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 19 Nov 2009 19:42:52 +0000 Subject: [PATCH] Do not use the unreliable in_the_loop() when grabbing terms. fixes #11189 git-svn-id: https://develop.svn.wordpress.org/trunk@12224 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/category-template.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 96c5322ace..c81387f879 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -867,11 +867,12 @@ function get_the_terms( $id = 0, $taxonomy ) { $id = (int) $id; - if ( ! $id && ! in_the_loop() ) - return false; // in-the-loop function - - if ( !$id ) - $id = (int) $post->ID; + if ( !$id ) { + if ( !$post->ID ) + return false; + else + $id = (int) $post->ID; + } $terms = get_object_term_cache( $id, $taxonomy ); if ( false === $terms )