WordPress.org

Make WordPress Core

Ticket #11423: 11423.refresh.diff

File 11423.refresh.diff, 815 bytes (added by xibe, 4 years ago)

Refreshed patch.

  • wp-includes/general-template.php

     
    554554                $title = $title->display_name; 
    555555        } 
    556556        if ( !empty($author_name) ) { 
    557                 // We do a direct query here because we don't cache by nicename. 
    558                 $title = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM $wpdb->users WHERE user_nicename = %s", $author_name)); 
     557                if ( ( $user_id = wp_cache_get($author_name, 'userslugs') ) && ( $user = wp_cache_get($user_id, 'users') ) )  
     558                        $title = $user->display_name;  
     559                else  
     560                        $title = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM $wpdb->users WHERE user_nicename = %s", $author_name));  
    559561        } 
    560562 
    561563        // If there's a month