Make WordPress Core


Ignore:
Timestamp:
03/22/2011 08:06:38 PM (15 years ago)
Author:
ryan
Message:

Return false instead of WP_Error from get_term_by() if the term does not exist. Makes fetching a term by id consistent with slug and name. Props hakre. fixes #16464 #16717 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r17512 r17526  
    890890        $field = 't.name';
    891891    } else {
    892         return get_term( (int) $value, $taxonomy, $output, $filter);
     892        $term = get_term( (int) $value, $taxonomy, $output, $filter);
     893        if ( is_wp_error( $term ) )
     894            $term = false;
     895        return $term;
    893896    }
    894897
Note: See TracChangeset for help on using the changeset viewer.