From 2b7d7f483349cbcabe92721d7e80c01240e7eeab Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 18 Aug 2016 19:15:32 +0000 Subject: [PATCH] In `is_object_in_term()`, return error object rather than caching it. This change prevents an error object from being stored in the cache, and prevents notices from being thrown when plucking term IDs to put into the relationship cache. See #32044, #36814. Props rpayne7264. Fixes #37721. Built from https://develop.svn.wordpress.org/trunk@38277 git-svn-id: http://core.svn.wordpress.org/trunk@38218 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 104a4afdb5..70af35a326 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -4274,6 +4274,10 @@ function is_object_in_term( $object_id, $taxonomy, $terms = null ) { $object_terms = get_object_term_cache( $object_id, $taxonomy ); if ( false === $object_terms ) { $object_terms = wp_get_object_terms( $object_id, $taxonomy, array( 'update_term_meta_cache' => false ) ); + if ( is_wp_error( $object_terms ) ) { + return $object_terms; + } + wp_cache_set( $object_id, wp_list_pluck( $object_terms, 'term_id' ), "{$taxonomy}_relationships" ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 6b6da98d7c..58ed8ce655 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38276'; +$wp_version = '4.7-alpha-38277'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.