mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-10 07:34:34 +00:00
Taxonomy: Avoid duplicates when querying for terms in taxonomies registered with $args parameter.
[40514] introduced a bug that caused term queries to return some duplicates when the `$taxonomies` array contained only taxonomies that were originally registered with an `$args` array. We fix this bug by ensuring that recursive `get_terms()` queries stop when all queried `$taxonomies` have already been referenced. Props bor0, atanasangelovdev. Fixes #41010. git-svn-id: https://develop.svn.wordpress.org/trunk@41037 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1917,7 +1917,10 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
|
||||
$args['taxonomy'] = $taxonomies;
|
||||
$args['object_ids'] = $object_ids;
|
||||
|
||||
$terms = array_merge( $terms, get_terms( $args ) );
|
||||
// Taxonomies registered without an 'args' param are handled here.
|
||||
if ( ! empty( $taxonomies ) ) {
|
||||
$terms = array_merge( $terms, get_terms( $args ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the terms for a given object or objects.
|
||||
|
||||
Reference in New Issue
Block a user