Do not use the unreliable in_the_loop() when grabbing terms. fixes #11189
git-svn-id: http://svn.automattic.com/wordpress/trunk@12224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c8ead9801c
commit
66ce42a9f9
|
@ -867,11 +867,12 @@ function get_the_terms( $id = 0, $taxonomy ) {
|
||||||
|
|
||||||
$id = (int) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
if ( ! $id && ! in_the_loop() )
|
if ( !$id ) {
|
||||||
return false; // in-the-loop function
|
if ( !$post->ID )
|
||||||
|
return false;
|
||||||
if ( !$id )
|
else
|
||||||
$id = (int) $post->ID;
|
$id = (int) $post->ID;
|
||||||
|
}
|
||||||
|
|
||||||
$terms = get_object_term_cache( $id, $taxonomy );
|
$terms = get_object_term_cache( $id, $taxonomy );
|
||||||
if ( false === $terms )
|
if ( false === $terms )
|
||||||
|
|
Loading…
Reference in New Issue