Skip to content

Commit df2b276

Browse files
committed
Further narrow type check to be specifically an array
1 parent 792bed6 commit df2b276

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/wp-includes/taxonomy.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,8 +1999,11 @@ 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_wp_error( $term_ids ) ) {
2003-
// Skip this taxonomy if it returns an error
2002+
if ( ! is_array( $term_ids ) ) {
2003+
/*
2004+
* Skip this taxonomy if it doesn't return an array. It could return a WP_Error, or it could return a string,
2005+
* or with the 'wp_get_object_terms' filter it could return anything.
2006+
*/
20042007
continue;
20052008
}
20062009
$term_ids = array_map( 'intval', $term_ids );

0 commit comments

Comments
 (0)