Skip to content

Commit

Permalink
Only call wp_get_object_terms() if get_object_term_cache() says there…
Browse files Browse the repository at this point in the history
… is no cache (false), which is different than no terms. props wonderboymusic, fixes #16505.

git-svn-id: http://core.svn.wordpress.org/trunk@22433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Nov 7, 2012
1 parent 8d07980 commit 039279d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wp-admin/includes/media.php
Expand Up @@ -985,7 +985,7 @@ function get_attachment_fields_to_edit($post, $errors = null) {
$t['args'] = array();

$terms = get_object_term_cache($post->ID, $taxonomy);
if ( empty($terms) )
if ( false === $terms )
$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);

$values = array();
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/taxonomy.php
Expand Up @@ -3111,7 +3111,7 @@ function get_the_taxonomies($post = 0, $args = array() ) {
$t['template'] = $template;

$terms = get_object_term_cache($post->ID, $taxonomy);
if ( empty($terms) )
if ( false === $terms )
$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);

$links = array();
Expand Down Expand Up @@ -3161,7 +3161,7 @@ function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );

$object_terms = get_object_term_cache( $object_id, $taxonomy );
if ( empty( $object_terms ) )
if ( false === $terms )
$object_terms = wp_get_object_terms( $object_id, $taxonomy );

if ( is_wp_error( $object_terms ) )
Expand Down

0 comments on commit 039279d

Please sign in to comment.