Ticket #18828: 18828.2.diff
File 18828.2.diff, 2.4 KB (added by , 10 years ago) |
---|
-
src/wp-includes/taxonomy.php
2693 2693 if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) 2694 2694 $order = 'ASC'; 2695 2695 2696 $ taxonomies = "'" . implode("', '", $taxonomies) . "'";2697 $ object_ids = implode(', ', $object_ids);2696 $_taxonomies = "'" . implode("', '", $taxonomies) . "'"; 2697 $_object_ids = implode(', ', $object_ids); 2698 2698 2699 2699 $select_this = ''; 2700 2700 if ( 'all' == $fields ) { … … 2710 2710 } 2711 2711 2712 2712 $where = array( 2713 "tt.taxonomy IN ($ taxonomies)",2714 "tr.object_id IN ($ object_ids)",2713 "tt.taxonomy IN ($_taxonomies)", 2714 "tr.object_id IN ($_object_ids)", 2715 2715 ); 2716 2716 2717 2717 if ( '' !== $args['parent'] ) { … … 2739 2739 } 2740 2740 $terms = array_merge( $terms, $_terms ); 2741 2741 } elseif ( 'tt_ids' == $fields ) { 2742 $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");2742 $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"); 2743 2743 foreach ( $terms as $key => $tt_id ) { 2744 2744 $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. 2745 2745 } … … 2767 2767 * 2768 2768 * @since 2.8.0 2769 2769 * 2770 * @param array 2771 * @param array |int$object_ids Object ID or array of IDs.2772 * @param array |string$taxonomies A taxonomy or array of taxonomies.2773 * @param array 2774 * 2770 * @param array $terms An array of terms for the given object or objects. 2771 * @param array $object_ids Object ID or array of IDs. 2772 * @param array $taxonomies A taxonomy or array of taxonomies. 2773 * @param array $args An array of arguments for retrieving terms for 2774 * the given object(s). 2775 2775 */ 2776 2776 return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args ); 2777 2777 }