Changeset 53503 for trunk/src/wp-includes/class-wp-term-query.php
- Timestamp:
- 06/14/2022 04:15:52 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-term-query.php
r53496 r53503 485 485 $exclude_tree = wp_parse_id_list( $exclude_tree ); 486 486 $excluded_children = $exclude_tree; 487 487 488 foreach ( $exclude_tree as $extrunk ) { 488 489 $excluded_children = array_merge( … … 498 499 ); 499 500 } 501 500 502 $exclusions = array_merge( $excluded_children, $exclusions ); 501 503 } … … 532 534 533 535 if ( ! empty( $exclusions ) ) { 534 // Must do string manipulation here for backward compatibility with filter.536 // Strip leading 'AND'. Must do string manipulation here for backward compatibility with filter. 535 537 $this->sql_clauses['where']['exclusions'] = preg_replace( '/^\s*AND\s*/', '', $exclusions ); 536 538 } … … 544 546 if ( ! empty( $args['name'] ) ) { 545 547 $names = $args['name']; 548 546 549 foreach ( $names as &$_name ) { 547 550 // `sanitize_term_field()` returns slashed data. … … 651 654 652 655 if ( ! empty( $meta_clauses ) ) { 653 $join .= $mq_sql['join']; 656 $join .= $mq_sql['join']; 657 658 // Strip leading 'AND'. 654 659 $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $mq_sql['where'] ); 655 $distinct .= 'DISTINCT'; 660 661 $distinct .= 'DISTINCT'; 656 662 657 663 } … … 786 792 $cache = array_map( 'intval', $cache ); 787 793 } elseif ( 'count' !== $_fields ) { 788 if ( ( 'all_with_object_id' === $_fields && ! empty( $args['object_ids'] ) ) || ( 'all' === $_fields && $args['pad_counts'] ) ) { 794 if ( ( 'all_with_object_id' === $_fields && ! empty( $args['object_ids'] ) ) 795 || ( 'all' === $_fields && $args['pad_counts'] ) 796 ) { 789 797 $term_ids = wp_list_pluck( $cache, 'term_id' ); 790 798 } else { 791 799 $term_ids = array_map( 'intval', $cache ); 792 800 } 801 793 802 _prime_term_caches( $term_ids, $args['update_term_meta_cache'] ); 803 794 804 $term_objects = $this->populate_terms( $cache ); 795 805 $cache = $this->format_terms( $term_objects, $_fields ); … … 838 848 if ( ! $term->count ) { 839 849 $children = get_term_children( $term->term_id, $term->taxonomy ); 850 840 851 if ( is_array( $children ) ) { 841 852 foreach ( $children as $child_id ) { … … 887 898 $term_cache = wp_list_pluck( $term_objects, 'term_id' ); 888 899 } 900 889 901 wp_cache_add( $cache_key, $term_cache, 'terms' ); 890 902 $this->terms = $this->format_terms( $term_objects, $_fields );
Note: See TracChangeset
for help on using the changeset viewer.