Commit caed43f189 for wordpress.org
commit caed43f189116fe4e071ba4fa6a18075e014641c
Author: Weston Ruter <weston@xwp.co>
Date: Sun Dec 14 07:13:24 2025 +0000
Taxonomy: Avoid type error in `wp_delete_object_term_relationships()` when invalid taxonomy supplied.
Developed in https://github.com/WordPress/wordpress-develop/pull/10621
Props owolter, westonruter.
Fixes #64406.
Built from https://develop.svn.wordpress.org/trunk@61376
git-svn-id: http://core.svn.wordpress.org/trunk@60688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
index 69f3fe7484..c314d474e6 100644
--- a/wp-includes/taxonomy.php
+++ b/wp-includes/taxonomy.php
@@ -1999,6 +1999,10 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
foreach ( (array) $taxonomies as $taxonomy ) {
$term_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids' ) );
+ if ( ! is_array( $term_ids ) ) {
+ // Skip return value in the case of an error or the 'wp_get_object_terms' filter returning an invalid value.
+ continue;
+ }
$term_ids = array_map( 'intval', $term_ids );
wp_remove_object_terms( $object_id, $term_ids, $taxonomy );
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 01a30ee390..4b165f84af 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61375';
+$wp_version = '7.0-alpha-61376';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.