[wp-hackers] get_userdata and _fill_user causing huge number of database queries
piemanek at gmail.com
Thu Mar 4 15:28:56 UTC 2010
> A couple of suggestions:
1. Add paging to your listing so that you don't loop through 50+ posts on a
> single page.
> 2. In WP 3.0 there has been a revamp of the user handling with caching.
> At the beginning of this page, before you start your loop and calling
> the_post(), you can loop through $_GLOBAL['wp_query']->posts and get the
> user_ids that are needed to be cached. Then you can use the new
> functionality for cache_users() to go ahead and cache the user data with a
> single query.
thanks, that's very useful info. i'm really looking forward to 3.0 for lots
of reasons, now there's one more to add to my list.
i can't do number 1 unfortunately because all those posts have to be
displayed on one page - immovable customer requirement...
More information about the wp-hackers