Make WordPress Core


Ignore:
Timestamp:
04/17/2009 09:25:11 PM (16 years ago)
Author:
ryan
Message:

Cache user lookups made by nicename. Add get_user_by(). fixes #4170

File:
1 edited

Legend:

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

    r10956 r10992  
    20052005            $q['author_name'] = sanitize_title($q['author_name']);
    20062006            $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
     2007            $q['author'] = get_user_by('slug', $q['author_name']);
     2008            if ( $q['author'] )
     2009                $q['author'] = $q['author']->ID;
    20072010            $whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
    20082011        }
Note: See TracChangeset for help on using the changeset viewer.