WordPress.org

Make WordPress Core

Changeset 17506


Ignore:
Timestamp:
03/08/2011 10:06:35 PM (9 years ago)
Author:
ryan
Message:

Check for WP_Error return from get_term_by(). Props fabifott, kawauso, nacin. fixes #16717 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r17504 r17506  
    21912191                    $cat_query = reset( $cat_query );
    21922192                    $the_cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
    2193                     if ( $the_cat ) {
     2193                    if ( $the_cat && ! is_wp_error( $the_cat ) ) {
    21942194                        $this->set( 'cat', $the_cat->term_id );
    21952195                        $this->set( 'category_name', $the_cat->slug );
     
    22032203                    $tag_query = reset( $tag_query );
    22042204                    $the_tag = get_term_by( $tag_query['field'], $tag_query['terms'][0], 'post_tag' );
    2205                     if ( $the_tag ) {
     2205                    if ( $the_tag && ! is_wp_error( $the_tag ) ) {
    22062206                        $this->set( 'tag_id', $the_tag->term_id );
    22072207                    }
Note: See TracChangeset for help on using the changeset viewer.