Retrieves info for user lists to prevent multiple queries by get_userdata() .
Parameters
$user_ids
int[]required- User ID numbers list
Source
function cache_users( $user_ids ) {
global $wpdb;
update_meta_cache( 'user', $user_ids );
$clean = _get_non_cached_ids( $user_ids, 'users' );
if ( empty( $clean ) ) {
return;
}
$list = implode( ',', $clean );
$users = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($list)" );
foreach ( $users as $user ) {
update_user_caches( $user );
}
}
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.