Make WordPress Core


Ignore:
Timestamp:
10/16/2015 09:41:51 PM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

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

    r35170 r35227  
    752752        $new_term_id = _split_shared_term( $_term->term_id, $_term->term_taxonomy_id );
    753753
    754         // If no split occurred, this is an invalid request.
     754        // If no split occurred, this is an invalid request. Return null (not WP_Error) for back compat.
    755755        if ( $new_term_id === $_term->term_id ) {
    756             return new WP_Error( 'invalid_term', __( 'Empty Term' ) );
     756            return null;
    757757
    758758        // The term has been split. Refetch the term from the proper taxonomy.
Note: See TracChangeset for help on using the changeset viewer.