Skip to content

Commit 4e8ec47

Browse files
committed
Taxonomy: Avoid type error in wp_delete_object_term_relationships() when invalid taxonomy supplied.
Developed in WordPress/wordpress-develop#10621 Props owolter, westonruter. Fixes #64406. Built from https://develop.svn.wordpress.org/trunk@61376 git-svn-id: https://core.svn.wordpress.org/trunk@60688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 1d217fe commit 4e8ec47

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

wp-includes/taxonomy.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,6 +1999,10 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
19991999

20002000
foreach ( (array) $taxonomies as $taxonomy ) {
20012001
$term_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids' ) );
2002+
if ( ! is_array( $term_ids ) ) {
2003+
// Skip return value in the case of an error or the 'wp_get_object_terms' filter returning an invalid value.
2004+
continue;
2005+
}
20022006
$term_ids = array_map( 'intval', $term_ids );
20032007
wp_remove_object_terms( $object_id, $term_ids, $taxonomy );
20042008
}

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.0-alpha-61375';
19+
$wp_version = '7.0-alpha-61376';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)