Title: author.php query question
Last modified: August 19, 2016

---

# author.php query question

 *  Resolved [slivehappy](https://wordpress.org/support/users/slivehappy/)
 * (@slivehappy)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/authorphp-query-question/)
 * I am creating an author.php template
 * I would like to run a query based on the author_name but I don’t want to hard
   code the author_name
 * how to I modify this so it grabs the variable from the query string?
    query_posts(‘
   author_name=Harriet’);
 * Thanks

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

 *  Thread Starter [slivehappy](https://wordpress.org/support/users/slivehappy/)
 * (@slivehappy)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/authorphp-query-question/#post-1246515)
 * and of course sanitizes it .. I am sure that is built into wordpress
 *  Thread Starter [slivehappy](https://wordpress.org/support/users/slivehappy/)
 * (@slivehappy)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/authorphp-query-question/#post-1246528)
 * would like to run a query based on the author_name but I don’t want to hard code
   the author_name
 * query_posts(‘author_name=Harriet’);
 * how to I modify the query so it grabs the variable from the url?
 * [http://mysite.com/wp/author/bob](http://mysite.com/wp/author/bob) = query_posts(‘
   author_name=bob’);
 * [http://mysite.com/wp/author/sam](http://mysite.com/wp/author/sam) = query_posts(‘
   author_name=sam’);
 *  Thread Starter [slivehappy](https://wordpress.org/support/users/slivehappy/)
 * (@slivehappy)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/authorphp-query-question/#post-1246535)
 * this works
    <?php query_posts(‘author=’ . $curauth->ID . ‘&showposts=10’); ?>

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

The topic ‘author.php query question’ is closed to new replies.

## Tags

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

 * 3 replies
 * 1 participant
 * Last reply from: [slivehappy](https://wordpress.org/support/users/slivehappy/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/authorphp-query-question/#post-1246535)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
