diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 72b3e65d23..9e81ef2474 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -1137,9 +1137,15 @@ function get_the_terms( $post, $taxonomy ) { $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false === $terms ) { $terms = wp_get_object_terms( $post->ID, $taxonomy ); - wp_cache_add($post->ID, $terms, $taxonomy . '_relationships'); + $to_cache = array(); + foreach ( $terms as $key => $term ) { + $to_cache[ $key ] = $term->data; + } + wp_cache_add( $post->ID, $to_cache, $taxonomy . '_relationships' ); } + $terms = array_map( 'get_term', $terms ); + /** * Filter the list of terms attached to the given post. * diff --git a/wp-includes/class-wp-term.php b/wp-includes/class-wp-term.php index f170dcf3b5..9403641e03 100644 --- a/wp-includes/class-wp-term.php +++ b/wp-includes/class-wp-term.php @@ -95,6 +95,15 @@ final class WP_Term { */ public $count = 0; + /** + * Info about the term, as stored in the database. + * + * @since 4.4.0 + * @access protected + * @var array + */ + protected $data = array(); + /** * Stores the term object's sanitization level. * @@ -157,6 +166,8 @@ final class WP_Term { foreach ( get_object_vars( $term ) as $key => $value ) { $this->$key = $value; } + + $this->data = sanitize_term( $term, $this->taxonomy, $this->filter ); } /** @@ -182,4 +193,20 @@ final class WP_Term { public function to_array() { return get_object_vars( $this ); } + + /** + * Getter. + * + * @since 4.4.0 + * @access public + * + * @return mixed + */ + public function __get( $key ) { + switch ( $key ) { + case 'data' : + return sanitize_term( $this->{$key}, $this->data->taxonomy, 'raw' ); + break; + } + } } diff --git a/wp-includes/taxonomy-functions.php b/wp-includes/taxonomy-functions.php index 8d8b6a75d2..0c89ac1e51 100644 --- a/wp-includes/taxonomy-functions.php +++ b/wp-includes/taxonomy-functions.php @@ -3062,7 +3062,7 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) { $term_id = (int) $term_id; // First, get all of the original args - $term = get_term( $term_id, $taxonomy, ARRAY_A ); + $term = get_term( $term_id, $taxonomy ); if ( is_wp_error( $term ) ) { return $term; @@ -3072,8 +3072,10 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) { return new WP_Error( 'invalid_term', __( 'Empty Term' ) ); } + $term = (array) $term->data; + // Escape data pulled from DB. - $term = wp_slash($term); + $term = wp_slash( $term ); // Merge old and new args with new args overwriting old ones. $args = array_merge($term, $args); diff --git a/wp-includes/version.php b/wp-includes/version.php index bddd3ce602..a55fc03fba 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35031'; +$wp_version = '4.4-alpha-35032'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.