WordPress.org

Make WordPress Core

Changeset 15827


Ignore:
Timestamp:
10/17/2010 06:14:58 AM (8 years ago)
Author:
dd32
Message:

Prevent notices on non-existent Term locations (such as /tag/404-non-existant-term/)

File:
1 edited

Legend:

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

    r15825 r15827  
    25782578        if ( !empty( $tax_query ) ) {
    25792579            $query = reset( $tax_query );
     2580
    25802581            if ( 'term_id' == $query['field'] )
    25812582                $term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
     
    25832584                $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
    25842585
    2585             $this->queried_object = $term;
    2586             $this->queried_object_id = $term->term_id;
     2586            if ( $term && ! is_wp_error($term) )  {
     2587                $this->queried_object = $term;
     2588                $this->queried_object_id = $term->term_id;
     2589            }
    25872590        } elseif ( $this->is_posts_page ) {
    25882591            $page_for_posts = get_option('page_for_posts');
Note: See TracChangeset for help on using the changeset viewer.