mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-14 01:24:27 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@35227 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user