Changeset 32326 for trunk/src/wp-includes/taxonomy.php
- Timestamp:
- 04/29/2015 12:55:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r32297 r32326 3927 3927 * @param array $ancestors Term ancestors that have already been identified. Passed by reference, to keep track of 3928 3928 * found terms when recursing the hierarchy. The array of located ancestors is used to prevent 3929 * infinite recursion loops. 3929 * infinite recursion loops. For performance, term_ids are used as array keys, with 1 as value. 3930 3930 * @return array The subset of $terms that are descendants of $term_id. 3931 3931 */ … … 3943 3943 // Include the term itself in the ancestors array, so we can properly detect when a loop has occurred. 3944 3944 if ( empty( $ancestors ) ) { 3945 $ancestors[ ] = $term_id;3945 $ancestors[ $term_id ] = 1; 3946 3946 } 3947 3947 … … 3956 3956 3957 3957 // Don't recurse if we've already identified the term as a child - this indicates a loop. 3958 if ( i n_array( $term->term_id, $ancestors) ) {3958 if ( isset( $ancestors[ $term->term_id ] ) ) { 3959 3959 continue; 3960 3960 } … … 3969 3969 continue; 3970 3970 3971 if ( $use_id ) { 3972 $ancestors = array_merge( $ancestors, $term_list ); 3973 } else { 3974 $ancestors = array_merge( $ancestors, wp_list_pluck( $term_list, 'term_id' ) ); 3975 } 3971 $ancestors[ $term->term_id ] = 1;; 3976 3972 3977 3973 if ( $children = _get_term_children( $term->term_id, $terms, $taxonomy, $ancestors) )
Note: See TracChangeset
for help on using the changeset viewer.