Make WordPress Core

Changeset 36516


Ignore:
Timestamp:
02/12/2016 02:25:05 PM (10 years ago)
Author:
boonebgorges
Message:

Bail from get_term() if a filter returns an object that is not a WP_Term.

This prevents fatal errors in certain cases.

Props tmuikku.
Fixes #35808.

File:
1 edited

Legend:

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

    r36508 r36516  
    857857         */
    858858        $_term = apply_filters( "get_$taxonomy", $_term, $taxonomy );
     859
     860        // Bail if a filter callback has changed the type of the `$_term` object.
     861        if ( ! ( $_term instanceof WP_Term ) ) {
     862                return $_term;
     863        }
    859864
    860865        // Sanitize term, according to the specified filter.
Note: See TracChangeset for help on using the changeset viewer.