Changeset 7904

Show
Ignore:
Timestamp:
05/07/08 19:12:44 (3 months ago)
Author:
ryan
Message:

[7064] introduces an extra query for each call to in_category(). Avoid the query if an int is passed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/category-template.php

    r7903 r7904  
    186186        return false; 
    187187 
    188     $cat_ID = get_cat_ID($category); 
    189     if ( $cat_ID ) 
    190         $category = $cat_ID; 
     188    // If category is not an int, check to see if it's a name 
     189    if ( ! is_int($category) ) { 
     190        $cat_ID = get_cat_ID($category); 
     191        if ( $cat_ID ) 
     192            $category = $cat_ID; 
     193    } 
    191194 
    192195    $categories = get_object_term_cache($post->ID, 'category');