Ticket #18828: taxonomy_wp_get_object_terms.php.patch
File taxonomy_wp_get_object_terms.php.patch, 2.2 KB (added by , 10 years ago) |
---|
-
wp-includes/taxonomy.php
2254 2254 if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) 2255 2255 $order = 'ASC'; 2256 2256 2257 $ taxonomies = "'" . implode("', '", $taxonomies) . "'";2258 $ object_ids = implode(', ', $object_ids);2257 $_taxonomies = "'" . implode("', '", $taxonomies) . "'"; 2258 $_object_ids = implode(', ', $object_ids); 2259 2259 2260 2260 $select_this = ''; 2261 2261 if ( 'all' == $fields ) … … 2269 2269 else if ( 'all_with_object_id' == $fields ) 2270 2270 $select_this = 't.*, tt.*, tr.object_id'; 2271 2271 2272 $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";2272 $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_in) AND tr.object_id IN ($_object_ids) $orderby $order"; 2273 2273 2274 2274 if ( 'all' == $fields || 'all_with_object_id' == $fields ) { 2275 2275 $_terms = $wpdb->get_results( $query ); … … 2286 2286 } 2287 2287 $terms = array_merge( $terms, $_terms ); 2288 2288 } else if ( 'tt_ids' == $fields ) { 2289 $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($ object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order");2289 $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($_object_ids) AND tt.taxonomy IN ($_taxonomies_in) $orderby $order"); 2290 2290 foreach ( $terms as $key => $tt_id ) { 2291 2291 $terms[$key] = sanitize_term_field( 'term_taxonomy_id', $tt_id, 0, $taxonomy, 'raw' ); // 0 should be the term id, however is not needed when using raw context. 2292 2292 }