WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two authors pages, one displays about 5 posts. Then I'm trying to setup another page that will be all of their posts. I have created a template called moreauthorposts.php and I'm trying to pass the author variable to this page. Problem is if i pass domain.com/more-author-posts?author=johndoe it gets stripped out. How can I retrieve this value? Is this even possible in wordpress? I know WP Rewrite is jacking my URL structure somehow I'm just not sure.

I've tried:


and tried reading this but didn't have any luck:




share|improve this question
up vote 17 down vote accepted

I'm almost sure that author is built-in, so use something like author_more. You will need to add that var to query_vars first. Example:

// add `author_more` to query vars
add_filter( 'init', 'add_author_more_query_var' );
function add_author_more_query_var()
    global $wp;
    $wp->add_query_var( 'author_more' );

Then on your more-author-posts.php template call it like this:

if ( get_query_var( 'author_more' ) )
    // do your stuff


This works in the following URl example/use case:


But if you want to use this as fancy URl, you need to add a rewrite rule:

function add_author_more_rewrite_rule()

Now you can use it like this

share|improve this answer
Ok so I added the query vars into the functions.php. Then added the other code to my more author posts. What would be the correct URL structure to pass these through? I know that paged uses the format of /page/2 but doing more-author-posts/more_author/johndoe doesnt' seem to be working? – codeisforeva Jan 31 '11 at 20:03
i updated the answer – Bainternet Jan 31 '11 at 20:32
Problem is im not trying to pass the vars to index.php. Im trying to pass them to the custom template I have developed since it looks completely different from index. So if I pass values to moreauthor.php?author_more=johndoe .. that doesnt seem to work. Doing something wrong here? – codeisforeva Jan 31 '11 at 20:46
@בניית אתרים looks like a very clear answer! @codeisforeva You shouldn't be calling the template file directly, should you? index.php is just the root file of wordpress, every rewrite rule should go through there. – goldenapples Jan 31 '11 at 22:20
@codeisforeva: The index.php in the rewrite rule is the index.php in the root directory of WordPress, not the index.php in your template file. You can still choose which template should be displayed, by hooking into the template_include filter. – Jan Fabry Feb 7 '11 at 17:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.