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.
Built from https://develop.svn.wordpress.org/trunk@36516


git-svn-id: http://core.svn.wordpress.org/trunk@36483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-02-12 14:26:27 +00:00
parent 58fe478fe1
commit 0e27fdcc47
2 changed files with 6 additions and 1 deletions

View File

@ -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 );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36515';
$wp_version = '4.5-alpha-36516';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.