Skip to content

Instantly share code, notes, and snippets.

@sscovil
Created July 12, 2013 18:01
Show Gist options
  • Save sscovil/5986445 to your computer and use it in GitHub Desktop.
Save sscovil/5986445 to your computer and use it in GitHub Desktop.
<?php
// Use WP_User_Query to grab an array of user IDs.
$user_query = new WP_User_Query( array(
'fields' => 'ID'
) );
$user_ids = $user_query->get_results();
// Loop through each user ID.
foreach( $user_ids as $user_id ) {
// Use get_userdata() to get a user object with info stored in the 'user' database table.
$user_object = get_userdata( $user_id );
echo
get_avatar( $user_id )
. '<h1>'
. $user_object->display_name
. '</h1>'
. '<div class="biography">'
// Use get_user_meta() to grab individual bits of data stored in the 'usermeta' database table.
. get_user_meta( $user_id, 'description', true )
. '</div>'
;
}
?>
@sscovil
Copy link
Author

sscovil commented Jul 12, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment