| | 367 | } |
|---|
| | 368 | |
|---|
| | 369 | function get_objects_in_term( $terms, $taxonomies, $args = array() ) { |
|---|
| | 370 | global $wpdb; |
|---|
| | 371 | |
|---|
| | 372 | if ( !is_array( $terms) ) |
|---|
| | 373 | $terms = array($terms); |
|---|
| | 374 | |
|---|
| | 375 | if ( !is_array($taxonomies) ) |
|---|
| | 376 | $taxonomies = array($taxonomies); |
|---|
| | 377 | |
|---|
| | 378 | $defaults = array('order' => 'ASC'); |
|---|
| | 379 | $args = wp_parse_args( $args, $defaults ); |
|---|
| | 380 | extract($args); |
|---|
| | 381 | |
|---|
| | 382 | $taxonomies = "'" . implode("', '", $taxonomies) . "'"; |
|---|
| | 383 | $terms = "'" . 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 ($in_terms) ORDER BY tr.object_id $order"); |
|---|
| | 386 | |
|---|
| | 387 | if ( ! $object_ids ) |
|---|
| | 388 | return array(); |
|---|
| | 389 | |
|---|
| | 390 | return $object_ids; |
|---|