Title: Get author ids from loop
Last modified: August 21, 2016

---

# Get author ids from loop

 *  [donelpasso](https://wordpress.org/support/users/donelpasso/)
 * (@donelpasso)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/get-author-ids-from-loop/)
 * Hi
    I need an array of all author ids of the found posts. With get_posts() i 
   get everything but i need only the author ids and only each one time and the 
   full list, not only 5 or anything. Whats the code for that?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [donelpasso](https://wordpress.org/support/users/donelpasso/)
 * (@donelpasso)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/get-author-ids-from-loop/#post-4023104)
 * only answers for “how to change background” question? -.-
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/get-author-ids-from-loop/#post-4023255)
 * > an array of all author ids of the found posts
 * try:
 *     ```
       $all = get_posts('posts_per_page=-1');
       $author_ids = array_unique( wp_list_pluck( $all, 'post_author' ) );
       var_dump( $author_ids );
       ```
   
 * [http://codex.wordpress.org/Function_Reference/wp_list_pluck](http://codex.wordpress.org/Function_Reference/wp_list_pluck)
   
   [http://php.net/manual/en/function.array-unique.php](http://php.net/manual/en/function.array-unique.php)
 * depending on what you want to achieve, possibly also review
    [http://codex.wordpress.org/Function_Reference/wp_list_authors](http://codex.wordpress.org/Function_Reference/wp_list_authors)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Get author ids from loop’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/get-author-ids-from-loop/#post-4023255)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
