In `wp_get_object_terms()`, before returning terms (and before running them through the 'wp_get_object_terms' filter) - run them through `$terms = array_values( array_unique( $terms, SORT_REGULAR ) )`.
There will be "dupes" when the function is called with `'fields' => 'all_with_object_id'`, but the objects will actually be unique due to the `object_id` addition, so they shouldn't be filtered out. Adds unit tests. All other unit tests pass. Fixes #11003. Built from https://develop.svn.wordpress.org/trunk@28583 git-svn-id: http://core.svn.wordpress.org/trunk@28408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
714aae91ea
commit
8653099a83
|
@ -2337,9 +2337,11 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! $terms )
|
||||
if ( ! $terms ) {
|
||||
$terms = array();
|
||||
|
||||
} else {
|
||||
$terms = array_values( array_unique( $terms, SORT_REGULAR ) );
|
||||
}
|
||||
/**
|
||||
* Filter the terms for a given object or objects.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue