Make WordPress Core


Ignore:
Timestamp:
07/13/2017 01:40:39 PM (7 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

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

    r40994 r41037  
    19181918    $args['object_ids'] = $object_ids;
    19191919
    1920     $terms = array_merge( $terms, get_terms( $args ) );
     1920    // Taxonomies registered without an 'args' param are handled here.
     1921    if ( ! empty( $taxonomies ) ) {
     1922        $terms = array_merge( $terms, get_terms( $args ) );
     1923    }
    19211924
    19221925    /**
Note: See TracChangeset for help on using the changeset viewer.