Changeset 31270 for trunk/src/wp-includes/taxonomy.php
- Timestamp:
- 01/23/2015 02:56:04 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r31248 r31270 2556 2556 * @since 2.3.0 2557 2557 * @since 4.2.0 Added support for 'taxonomy', 'parent', and 'term_taxonomy_id' values of `$orderby`. 2558 * Introduced `$parent` parameter. 2558 2559 * 2559 2560 * @global wpdb $wpdb WordPress database abstraction object. … … 2570 2571 * term objects being returned, 'ids' will return an array of integers, and 'names' an array 2571 2572 * of strings. 2573 * @type int $parent Optional. Limit results to the direct children of a given term ID. 2572 2574 * } 2573 2575 * @return array|WP_Error The requested term data or empty array if no terms found. … … 2592 2594 $object_ids = array_map('intval', $object_ids); 2593 2595 2594 $defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all'); 2596 $defaults = array( 2597 'orderby' => 'name', 2598 'order' => 'ASC', 2599 'fields' => 'all', 2600 'parent' => '', 2601 ); 2595 2602 $args = wp_parse_args( $args, $defaults ); 2596 2603 … … 2653 2660 $select_this = 't.*, tt.*, tr.object_id'; 2654 2661 } 2655 $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order"; 2662 2663 $where = array( 2664 "tt.taxonomy IN ($taxonomies)", 2665 "tr.object_id IN ($object_ids)", 2666 ); 2667 2668 if ( '' !== $args['parent'] ) { 2669 $where[] = $wpdb->prepare( 'tt.parent = %d', $args['parent'] ); 2670 } 2671 2672 $where = implode( ' AND ', $where ); 2673 2674 $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE $where $orderby $order"; 2656 2675 2657 2676 $objects = false;
Note: See TracChangeset
for help on using the changeset viewer.