Failed `get_term_by()` lookups should always return `false`.

Previously, we sometimes returned `null`.

Props charlestonsw, tyxla.
Fixes #33281.
Built from https://develop.svn.wordpress.org/trunk@34246


git-svn-id: http://core.svn.wordpress.org/trunk@34210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-09-16 18:50:26 +00:00
parent af593128a7
commit 6153a72796
2 changed files with 3 additions and 2 deletions

View File

@ -803,8 +803,9 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
$field = 'tt.term_taxonomy_id'; $field = 'tt.term_taxonomy_id';
} else { } else {
$term = get_term( (int) $value, $taxonomy, $output, $filter ); $term = get_term( (int) $value, $taxonomy, $output, $filter );
if ( is_wp_error( $term ) ) if ( is_wp_error( $term ) || is_null( $term ) ) {
$term = false; $term = false;
}
return $term; return $term;
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34245'; $wp_version = '4.4-alpha-34246';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.