Changeset 15731 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 10/06/2010 10:40:30 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r15712 r15731 531 531 532 532 return $wpdb->get_col( $sql ); 533 }534 535 /*536 * Retrieve object_ids matching one or more taxonomy queries537 *538 * @since 3.1.0539 *540 * @param array $queries A list of taxonomy queries. A query is an associative array:541 * 'taxonomy' string|array The taxonomy being queried542 * 'terms' string|array The list of terms543 * 'field' string Which term field is being used. Can be 'term_id', 'slug' or 'name'544 * 'operator' string Can be 'IN' and 'NOT IN'545 *546 * @return array|WP_Error List of matching object_ids; WP_Error on failure.547 */548 function wp_tax_query( $queries ) {549 global $wpdb;550 551 $sql = array();552 foreach ( $queries as $query ) {553 if ( !isset( $query['include_children'] ) )554 $query['include_children'] = true;555 $query['do_query'] = false;556 $sql[] = get_objects_in_term( $query['terms'], $query['taxonomy'], $query );557 }558 559 if ( 1 == count( $sql ) )560 return $wpdb->get_col( $sql[0] );561 562 $r = "SELECT object_id FROM $wpdb->term_relationships WHERE 1=1";563 foreach ( $sql as $query )564 $r .= " AND object_id IN ($query)";565 566 return $wpdb->get_col( $r );567 533 } 568 534
Note: See TracChangeset
for help on using the changeset viewer.