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
This commit is contained in:
Weston Ruter
2025-12-14 07:13:24 +00:00
parent 622411cf95
commit caed43f189
2 changed files with 5 additions and 1 deletions

View File

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

View File

@@ -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.