• Resolved cpatience

    (@cpatience)


    My authors template used to use the following code to get the meta data for authors and admins:

    $authors = array();
    foreach ($blogusers as $bloguser) {
    	$user = get_userdata($bloguser->ID);
    	if(!empty($hide_empty)) {
    		$numposts = count_user_posts($user->ID);
    		if($numposts < 1) continue;
    	}
    	$authors[] = (array) $user;
    }
    
    $adminauthors = array();
    foreach ($blogadmins as $blogadmins) {
    	$user = get_userdata($blogadmins->ID);
    	if(!empty($hide_empty)) {
    		$numposts = count_user_posts($user->ID);
    		if($numposts < 1) continue;
    	}
    	$adminauthors[] = (array) $user;
    }

    With get_userdata now being deprecated, what’s the best way to get the metadata for each author in the array?

Viewing 1 replies (of 1 total)
  • Thread Starter cpatience

    (@cpatience)

    Figured this out – simply replace the get_userdata line with:

    “$user = get_user_meta($bloguser->ID);”

Viewing 1 replies (of 1 total)
  • The topic ‘How to get user data foreach after get_userdata deprecated?’ is closed to new replies.