Changeset 13821 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 03/26/2010 02:00:17 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/taxonomy.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r13802 r13821 352 352 * @uses wp_parse_args() Creates an array from string $args. 353 353 * 354 * @param string|array $terms String of term or array of string values of terms that will be used354 * @param int|array $term_ids Term id or array of term ids of terms that will be used 355 355 * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names 356 356 * @param array|string $args Change the order of the object_ids, either ASC or DESC … … 358 358 * the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found. 359 359 */ 360 function get_objects_in_term( $term s, $taxonomies, $args = array() ) {360 function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) { 361 361 global $wpdb; 362 362 363 if ( ! is_array( $terms) )364 $term s = array($terms);365 366 if ( ! is_array($taxonomies) )367 $taxonomies = array( $taxonomies);363 if ( ! is_array( $term_ids ) ) 364 $term_ids = array( $term_ids ); 365 366 if ( ! is_array( $taxonomies ) ) 367 $taxonomies = array( $taxonomies ); 368 368 369 369 foreach ( (array) $taxonomies as $taxonomy ) { 370 if ( ! is_taxonomy( $taxonomy) )371 return new WP_Error( 'invalid_taxonomy', __('Invalid Taxonomy'));372 } 373 374 $defaults = array( 'order' => 'ASC');370 if ( ! is_taxonomy( $taxonomy ) ) 371 return new WP_Error( 'invalid_taxonomy', __( 'Invalid Taxonomy' ) ); 372 } 373 374 $defaults = array( 'order' => 'ASC' ); 375 375 $args = wp_parse_args( $args, $defaults ); 376 extract( $args, EXTR_SKIP);377 378 $order = ( 'desc' == strtolower( $order) ) ? 'DESC' : 'ASC';379 380 $term s = array_map('intval', $terms);381 382 $taxonomies = "'" . implode( "', '", $taxonomies) . "'";383 $term s = "'" . implode("', '", $terms) . "'";384 385 $object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term s) ORDER BY tr.object_id $order");376 extract( $args, EXTR_SKIP ); 377 378 $order = ( 'desc' == strtolower( $order ) ) ? 'DESC' : 'ASC'; 379 380 $term_ids = array_map('intval', $term_ids ); 381 382 $taxonomies = "'" . implode( "', '", $taxonomies ) . "'"; 383 $term_ids = "'" . implode( "', '", $term_ids ) . "'"; 384 385 $object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order"); 386 386 387 387 if ( ! $object_ids )
Note: See TracChangeset
for help on using the changeset viewer.