| 1 | Index: wp-includes/query.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/query.php (revision 12396) |
|---|
| 4 | +++ wp-includes/query.php (working copy) |
|---|
| 5 | @@ -1986,10 +1986,11 @@ |
|---|
| 6 | } |
|---|
| 7 | } |
|---|
| 8 | $q['author_name'] = sanitize_title($q['author_name']); |
|---|
| 9 | - $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); |
|---|
| 10 | $q['author'] = get_user_by('slug', $q['author_name']); |
|---|
| 11 | if ( $q['author'] ) |
|---|
| 12 | $q['author'] = $q['author']->ID; |
|---|
| 13 | + else |
|---|
| 14 | + $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); |
|---|
| 15 | $whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')'; |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | Index: wp-includes/general-template.php |
|---|
| 19 | =================================================================== |
|---|
| 20 | --- wp-includes/general-template.php (revision 12396) |
|---|
| 21 | +++ wp-includes/general-template.php (working copy) |
|---|
| 22 | @@ -458,8 +458,10 @@ |
|---|
| 23 | $title = $title->display_name; |
|---|
| 24 | } |
|---|
| 25 | if ( !empty($author_name) ) { |
|---|
| 26 | - // We do a direct query here because we don't cache by nicename. |
|---|
| 27 | - $title = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM $wpdb->users WHERE user_nicename = %s", $author_name)); |
|---|
| 28 | + if ( ( $user_id = wp_cache_get($author_name, 'userslugs') ) && ( $user = wp_cache_get($user_id, 'users') ) ) |
|---|
| 29 | + $title = $user->display_name; |
|---|
| 30 | + else |
|---|
| 31 | + $title = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM $wpdb->users WHERE user_nicename = %s", $author_name)); |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | // If there's a month |
|---|