WordPress.org

Make WordPress Core

Ticket #18828: 18828.2.diff

File 18828.2.diff, 2.4 KB (added by wonderboymusic, 7 years ago)
  • src/wp-includes/taxonomy.php

     
    26932693        if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) )
    26942694                $order = 'ASC';
    26952695
    2696         $taxonomies = "'" . implode("', '", $taxonomies) . "'";
    2697         $object_ids = implode(', ', $object_ids);
     2696        $_taxonomies = "'" . implode("', '", $taxonomies) . "'";
     2697        $_object_ids = implode(', ', $object_ids);
    26982698
    26992699        $select_this = '';
    27002700        if ( 'all' == $fields ) {
     
    27102710        }
    27112711
    27122712        $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)",
    27152715        );
    27162716
    27172717        if ( '' !== $args['parent'] ) {
     
    27392739                }
    27402740                $terms = array_merge( $terms, $_terms );
    27412741        } 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");
    27432743                foreach ( $terms as $key => $tt_id ) {
    27442744                        $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.
    27452745                }
     
    27672767         *
    27682768         * @since 2.8.0
    27692769         *
    2770          * @param array        $terms      An array of terms for the given object or objects.
    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        $args       An array of arguments for retrieving terms for
    2774          *                                 the given object(s).
     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).
    27752775         */
    27762776        return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args );
    27772777}