Title: List posts using $curauth
Last modified: August 21, 2016

---

# List posts using $curauth

 *  [urbanty](https://wordpress.org/support/users/urbanty/)
 * (@urbanty)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/list-posts-using-curauth/)
 * Hi,
 * I want to display five post titles of a specific author using $curauth;
    I had
   a snippet of code that used to work just fine, but with some WordPress update
   it stopped working and I’m not sure why or how to fix it. My old, formerly flawlessly
   working code looks like this:
 *     ```
       <ul><?php query_posts('&author='.$curauth->ID.'showposts=5'); if (have_posts()) : while (have_posts()) : the_post(); ?>
       <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> am <?php the_time('d.m.Y'); ?></li>
       <?php endwhile;?>
       </ul>
       <a href="<?php echo get_author_posts_url($authid); ?>?allposts=true">all posts by <?php echo $curauth->first_name; ?> →</a>
       <?php else: ?>
       <li><?php _e('No posts found.'); ?></li>
       </ul>
       <?php endif; ?>
       ```
   
 * Now, it always returns “No posts found”.
    When checking the documentation of 
   $query_posts I learned that it’s not recommended to use it anymore, but I don’t
   know what the alternative is and how to make this work again.
 * Any ideas? Thanks a lot! 🙂

The topic ‘List posts using $curauth’ is closed to new replies.

## Tags

 * [$curauth](https://wordpress.org/support/topic-tag/curauth/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * 0 replies
 * 1 participant
 * Last reply from: [urbanty](https://wordpress.org/support/users/urbanty/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/list-posts-using-curauth/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
