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
This commit is contained in:
parent
e540e6b3ce
commit
fb2d04d68e
|
@ -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 )
|
||||
if ( !$id ) {
|
||||
if ( !$post->ID )
|
||||
return false;
|
||||
else
|
||||
$id = (int) $post->ID;
|
||||
}
|
||||
|
||||
$terms = get_object_term_cache( $id, $taxonomy );
|
||||
if ( false === $terms )
|
||||
|
|
Loading…
Reference in New Issue