Make WordPress Core

Ticket #16465: 16465.diff

File 16465.diff, 1.6 KB (added by wonderboymusic, 11 years ago)
  • wp-includes/query.php

     
    22562256                                }
    22572257
    22582258                                $cat_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'category' ) );
    2259                                 if ( !empty( $cat_query ) ) {
     2259                                if ( ! empty( $cat_query ) ) {
    22602260                                        $cat_query = reset( $cat_query );
    2261                                         $the_cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
    2262                                         if ( $the_cat ) {
    2263                                                 $this->set( 'cat', $the_cat->term_id );
    2264                                                 $this->set( 'category_name', $the_cat->slug );
     2261
     2262                                        if ( ! empty( $cat_query['terms'][0] ) ) {
     2263                                                $the_cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
     2264                                                if ( $the_cat ) {
     2265                                                        $this->set( 'cat', $the_cat->term_id );
     2266                                                        $this->set( 'category_name', $the_cat->slug );
     2267                                                }
     2268                                                unset( $the_cat );
    22652269                                        }
    2266                                         unset( $the_cat );
    22672270                                }
    22682271                                unset( $cat_query );
    22692272
    22702273                                $tag_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'post_tag' ) );
    2271                                 if ( !empty( $tag_query ) ) {
     2274                                if ( ! empty( $tag_query ) ) {
    22722275                                        $tag_query = reset( $tag_query );
    2273                                         $the_tag = get_term_by( $tag_query['field'], $tag_query['terms'][0], 'post_tag' );
    2274                                         if ( $the_tag ) {
    2275                                                 $this->set( 'tag_id', $the_tag->term_id );
     2276
     2277                                        if ( ! empty( $tag_query['terms'][0] ) ) {
     2278                                                $the_tag = get_term_by( $tag_query['field'], $tag_query['terms'][0], 'post_tag' );
     2279                                                if ( $the_tag )
     2280                                                        $this->set( 'tag_id', $the_tag->term_id );
     2281                                                unset( $the_tag );
    22762282                                        }
    2277                                         unset( $the_tag );
    22782283                                }
    22792284                                unset( $tag_query );
    22802285                        }