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. git-svn-id: https://develop.svn.wordpress.org/trunk@36516 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cff37450eb
commit
b5bc8e336e
@ -857,6 +857,11 @@ function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
|
||||
*/
|
||||
$_term = apply_filters( "get_$taxonomy", $_term, $taxonomy );
|
||||
|
||||
// Bail if a filter callback has changed the type of the `$_term` object.
|
||||
if ( ! ( $_term instanceof WP_Term ) ) {
|
||||
return $_term;
|
||||
}
|
||||
|
||||
// Sanitize term, according to the specified filter.
|
||||
$_term->filter( $filter );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user