#13048 closed defect (bug) (fixed)
WP_Query gets the user ID for author archives twice
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Query | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
Currently WP_Query->get_posts does this:
$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); $q['author'] = get_user_by('slug', $q['author_name']);
Which potentially hits the DB twice for the same info. Looks like an old bit of functionality got left in when the get_user_by call was added. Would be better if it went like this:
$q['author'] = get_user_by('slug', $q['author_name']);
Attachments (1)
Change History (6)
Note: See
TracTickets for help on using
tickets.
A diff to stop WP_Query hitting the DB twice for the author ID on author archives