Be stricter about sanitizing values coming out of `WP_Term`.

Data passed into `get_instance()` should be run through `sanitize_term()`
before being used.

See #34262.

git-svn-id: https://develop.svn.wordpress.org/trunk@35031 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2015-10-12 15:12:22 +00:00
parent e8b0d11989
commit be5065a3ad
1 changed files with 4 additions and 6 deletions

View File

@ -139,7 +139,10 @@ final class WP_Term {
wp_cache_add( $term_id, $_term, 'terms' );
}
return new WP_Term( $_term );
$term_obj = new WP_Term( $_term );
$term_obj->filter( $term_obj->filter );
return $term_obj;
}
/**
@ -165,11 +168,6 @@ final class WP_Term {
* @param string $filter Filter context. Accepts 'edit', 'db', 'display', 'attribute', 'js', 'raw'.
*/
public function filter( $filter ) {
// Term has already been filtered - nothing more to do.
if ( isset( $this->filter ) && $this->filter === $filter ) {
return;
}
sanitize_term( $this, $this->taxonomy, $filter );
}