Make WordPress Core

Ticket #18828: 18828.diff

File 18828.diff, 2.5 KB (added by MikeHansenMe, 10 years ago)

Refreshed.

  • src/wp-includes/taxonomy.php

     
    26272627        }
    26282628
    26292629        // tt_ids queries can only be none or tr.term_taxonomy_id
    2630         if ( ('tt_ids' == $fields) && !empty($orderby) )
     2630        if ( ( 'tt_ids' == $fields ) && !empty( $orderby ) )
    26312631                $orderby = 'tr.term_taxonomy_id';
    26322632
    2633         if ( !empty($orderby) )
     2633        if ( !empty( $orderby ) )
    26342634                $orderby = "ORDER BY $orderby";
    26352635
    26362636        $order = strtoupper( $order );
    26372637        if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) )
    26382638                $order = 'ASC';
    26392639
    2640         $taxonomies = "'" . implode("', '", $taxonomies) . "'";
    2641         $object_ids = implode(', ', $object_ids);
     2640        $_taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
     2641        $_object_ids = implode( ', ', $object_ids );
    26422642
    26432643        $select_this = '';
    26442644        if ( 'all' == $fields ) {
     
    26522652        } elseif ( 'all_with_object_id' == $fields ) {
    26532653                $select_this = 't.*, tt.*, tr.object_id';
    26542654        }
    2655         $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";
     2655        $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";
    26562656
    26572657        $objects = false;
    26582658        if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
     
    26712671                }
    26722672                $terms = array_merge( $terms, $_terms );
    26732673        } elseif ( 'tt_ids' == $fields ) {
    2674                 $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");
     2674                $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" );
    26752675                foreach ( $terms as $key => $tt_id ) {
    26762676                        $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.
    26772677                }