Title: simple query_posts problem
Last modified: August 19, 2016

---

# simple query_posts problem

 *  Resolved [jmhagerman](https://wordpress.org/support/users/jmhagerman/)
 * (@jmhagerman)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/simple-query_posts-problem/)
 * All I am trying to do is pass the author ID variable to a query_posts statement
   so that I can display the last 5 posts by the same author of the existing post
   but in a different category.
 * Here is what I have tried:
    `<?php query_posts('show_posts=5&author=post_author-
   >ID&category_name=deals'); ?>`
 * This obviously isn’t working so my question is how do I pass the post_author 
   ID to the ‘author’ variable?

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/simple-query_posts-problem/#post-1395256)
 * Try:
 * `<?php query_posts('posts_per_page=5&author=' .$post->post_author' . '&category_name
   =deals'); ?>`
 *  Thread Starter [jmhagerman](https://wordpress.org/support/users/jmhagerman/)
 * (@jmhagerman)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/simple-query_posts-problem/#post-1395331)
 * esmi,
 * That was the ticket! With one exception which I am sure was just a typo – needed
   to remove the ‘ after post_author.
 * Thanks for your help! I knew it had to be simple…

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

The topic ‘simple query_posts problem’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [jmhagerman](https://wordpress.org/support/users/jmhagerman/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/simple-query_posts-problem/#post-1395331)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
