Title: show one users posts only
Last modified: August 18, 2016

---

# show one users posts only

 *  [bellbottombabe](https://wordpress.org/support/users/bellbottombabe/)
 * (@bellbottombabe)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/show-one-users-posts-only/)
 * hi,
 * This is probably an easy query (unless u don’t know of course) so presuming that
   u guys do ….
 * I need to show only the posts associated with the current user who is logged 
   in i.e. when user logs in they see a list of THEIR POSTS preferably within a 
   link to ‘edit this post’. I guess a, ‘get_posts_by_username’ type tag would be
   useful if one existed – or a plugin.
 * Thats all really — any ideas please???

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

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 2 months ago](https://wordpress.org/support/topic/show-one-users-posts-only/#post-533233)
 * query_posts(“author_name=YOUR USER NAME”) at the beginning of your loop will 
   do it.
 * [http://codex.wordpress.org/Template_Tags/query_posts](http://codex.wordpress.org/Template_Tags/query_posts)
 * [http://codex.wordpress.org/The_Loop](http://codex.wordpress.org/The_Loop)
 *  Thread Starter [bellbottombabe](https://wordpress.org/support/users/bellbottombabe/)
 * (@bellbottombabe)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/show-one-users-posts-only/#post-533235)
 * hi, thanks for ur quick reply –
 * to clarify,
    [1] do you mean place this within the loop (first line inside the
   loop) or completely outside the loop.
 * [2]
    what variable do i pass into this function in place of, “YOUR USER NAME”–
   since i can’t specify it literally (i.e. it must be derived from the user that
   is currently logged in)
 * [3]
    I’m using my own loop since i’m using my own static home.php page will this
   still work in this situation – i’ve copied most of the main template tags to 
   it such as header(), sidebar() etc….
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 2 months ago](https://wordpress.org/support/topic/show-one-users-posts-only/#post-533239)
 * 1. Just before the loop. Not inside it.
    2. Probably better to use the author
   =ID# instead. Then you just need to check $user and $user->ID to see who’s logged
   in. `if ($user) { query_posts('author='.$user->ID); }`, basically. 3. Should 
   work okay. Depends on how your custom loop works.

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

The topic ‘show one users posts only’ is closed to new replies.

## Tags

 * [by](https://wordpress.org/support/topic-tag/by/)
 * [get](https://wordpress.org/support/topic-tag/get/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/show-one-users-posts-only/#post-533239)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
