From 4430e5dbbb2f5ed67f5ae9fe432caea5dbe6d180 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 16 Oct 2015 21:42:25 +0000 Subject: [PATCH] Return `null` from `get_term()` on taxonomy mismatch. [34997] caused `get_term()` to return an error object in the case when `$taxonomy` did not match the taxonomy of the located term. This was an inadvertant change from the previous behavior, when `get_term()` would return null in these cases. Props dlh. See #14162. Fixes #34332. Built from https://develop.svn.wordpress.org/trunk@35227 git-svn-id: http://core.svn.wordpress.org/trunk@35193 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy-functions.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/taxonomy-functions.php b/wp-includes/taxonomy-functions.php index c007ffed4d..3a3fd2a6cc 100644 --- a/wp-includes/taxonomy-functions.php +++ b/wp-includes/taxonomy-functions.php @@ -751,9 +751,9 @@ function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) { // If there are two terms with the same ID, split the other one to a new term. $new_term_id = _split_shared_term( $_term->term_id, $_term->term_taxonomy_id ); - // If no split occurred, this is an invalid request. + // If no split occurred, this is an invalid request. Return null (not WP_Error) for back compat. if ( $new_term_id === $_term->term_id ) { - return new WP_Error( 'invalid_term', __( 'Empty Term' ) ); + return null; // The term has been split. Refetch the term from the proper taxonomy. } else { diff --git a/wp-includes/version.php b/wp-includes/version.php index 8bc9fc8fd4..5d78c6c7b8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35226'; +$wp_version = '4.4-alpha-35227'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.