Make WordPress Core

Changeset 7904


Ignore:
Timestamp:
05/07/2008 07:12:44 PM (15 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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');
Note: See TracChangeset for help on using the changeset viewer.