Title: Query posts written by specific user
Last modified: August 20, 2016

---

# Query posts written by specific user

 *  [hraban](https://wordpress.org/support/users/hraban/)
 * (@hraban)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/query-posts-written-by-specific-user/)
 * Hey,
    Is there any way to query posts written by some specific user (currently
   logged in)? I know this can be achieved by custom SQL query, but there should
   be a native built in function, isn’t it?

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

 *  [Jeffrey](https://wordpress.org/support/users/h0tw1r3/)
 * (@h0tw1r3)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/query-posts-written-by-specific-user/#post-2585328)
 *     ```
       $current_user = wp_get_current_user();
       if ( $current_user->ID > 0 ) {
           $query = new WP_Query('author='.$current_user->ID);
           while ( $query->have_posts() ): $query->the_post();
               the_title();
           endwhile;
           wp_reset_postdata();
       }
       ```
   
 *  Thread Starter [hraban](https://wordpress.org/support/users/hraban/)
 * (@hraban)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/query-posts-written-by-specific-user/#post-2585770)
 * Thanks, that did the trick! Shame I did not notice the presence of author argument
   in codex.

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

 The topic ‘Query posts written by specific user’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [hraban](https://wordpress.org/support/users/hraban/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/query-posts-written-by-specific-user/#post-2585770)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
