Make WordPress Core


Ignore:
Timestamp:
12/14/2025 07:11:49 AM (9 months ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r60933 r61376  
    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 );
Note: See TracChangeset for help on using the changeset viewer.