WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/18/2007 04:32:22 PM (13 years ago)
Author:
ryan
Message:

Add checks for WP_Error. Props filosofo. see #4809

File:
1 edited

Legend:

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

    r6071 r6125  
    3131function &get_category($category, $output = OBJECT, $filter = 'raw') {
    3232    $category = get_term($category, 'category', $output, $filter);
     33    if ( is_wp_error( $category ) )
     34        return $category;
    3335
    3436    _make_cat_compat($category);
     
    5961        while ( ($curcategory->parent != 0) && ($curcategory->parent != $curcategory->term_id) ) {
    6062            $curcategory = get_term($curcategory->parent, 'category');
     63            if ( is_wp_error( $curcategory ) )
     64                return $curcategory;
    6165            $path = '/' . $curcategory->slug . $path;
    6266        }
Note: See TracChangeset for help on using the changeset viewer.