Changeset 37683
- Timestamp:
- 06/11/2016 03:48:03 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-term-query.php
r37577 r37683 93 93 * 94 94 * @since 4.6.0 95 * @since 4.6.0 Introduced 'term_taxonomy_id' parameter. 95 96 * @access public 96 97 * … … 137 138 * @type string|array $slug Optional. Slug or array of slugs to return term(s) for. 138 139 * Default empty. 140 * @type int|array $term_taxonomy_id Optional. Term taxonomy ID, or array of term taxonomy IDs, 141 * to match when querying terms. 139 142 * @type bool $hierarchical Whether to include terms that have non-empty descendants (even 140 143 * if $hide_empty is set to true). Default true. … … 184 187 'name' => '', 185 188 'slug' => '', 189 'term_taxonomy_id' => '', 186 190 'hierarchical' => true, 187 191 'search' => '', … … 471 475 $slug = sanitize_title( $args['slug'] ); 472 476 $this->sql_clauses['where']['slug'] = "t.slug = '$slug'"; 477 } 478 } 479 480 if ( ! empty( $args['term_taxonomy_id'] ) ) { 481 if ( is_array( $args['term_taxonomy_id'] ) ) { 482 $tt_ids = implode( ',', array_map( 'intval', $args['term_taxonomy_id'] ) ); 483 $this->sql_clauses['where']['term_taxonomy_id'] = "tt.term_taxonomy_id IN ({$tt_ids})"; 484 } else { 485 $this->sql_clauses['where']['term_taxonomy_id'] = $wpdb->prepare( "tt.term_taxonomy_id = %d", $args['term_taxonomy_id'] ); 473 486 } 474 487 }
Note: See TracChangeset
for help on using the changeset viewer.