ap_post_author_pre_fetch( array $ids )

Description #

Pre fetch users and update cache.

Parameters #

  • $ids
    array (Required) User ids.

Source #

File: includes/functions.php

function ap_post_author_pre_fetch( $ids ) {
	$users = get_users(
		array(
			'include' => $ids,
			'fields'  => array( 'ID', 'user_login', 'user_nicename', 'user_email', 'display_name' ),
		)
	);

	foreach ( (array) $users as $user ) {
		update_user_caches( $user );
	}

	update_meta_cache( 'user', $ids );
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment