Make WordPress Core


Ignore:
Timestamp:
09/10/2013 02:27:24 AM (12 years ago)
Author:
wonderboymusic
Message:

Make sure the queried object is non-null before accessing its properties.

Props markoheijnen, ryan.
Fixes #21394.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/category-template.php

    r25119 r25310  
    466466        if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
    467467            $current_term_object = get_queried_object();
    468             if ( $r['taxonomy'] == $current_term_object->taxonomy )
     468            if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy )
    469469                $r['current_category'] = get_queried_object_id();
    470470        }
     
    10381038 */
    10391039function term_description( $term = 0, $taxonomy = 'post_tag' ) {
    1040     if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
     1040    if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
    10411041        $term = get_queried_object();
    1042         $taxonomy = $term->taxonomy;
    1043         $term = $term->term_id;
     1042        if ( $term ) {
     1043            $taxonomy = $term->taxonomy;
     1044            $term = $term->term_id;
     1045        }
    10441046    }
    10451047    $description = get_term_field( 'description', $term, $taxonomy );
Note: See TracChangeset for help on using the changeset viewer.