WordPress.org

Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #13048


Ignore:
Timestamp:
04/19/10 10:47:10 (4 years ago)
Author:
dd32
Comment:

fixed the code in the desc.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13048 – Description

    initial v2  
    11Currently WP_Query->get_posts does this: 
    22 
    3 ```                     $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); 
     3{{{ 
     4                        $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); 
    45                        $q['author'] = get_user_by('slug', $q['author_name']); 
    5 ``` 
     6}}} 
    67 
    78Which 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: 
    89 
    9 ```                     $q['author'] = get_user_by('slug', $q['author_name']); 
    10 ``` 
     10{{{ 
     11                        $q['author'] = get_user_by('slug', $q['author_name']); 
     12}}}