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

The following url resolves to the category template: http://localhost/author/myusername/?category_name=somecategory

I have a category-somecategory.php template and just a generic author.php template. Is there any way to make such a url use the author.php template instead of the category-somecategory.php? If not how can I filter on both category and author and force it to use the author template?

share|improve this question
up vote 3 down vote accepted

You could change the template loaded by hooking onto template_include, checking if is_author and is_category are both set, then switch the template for inclusion to the author template instead.

Give this a shot..

add_filter( 'template_include', 'my_template_setter' );
function my_template_setter( $template ) {
    if( is_author() && is_category() && is_archive() )
        $template = get_author_template();
    return $template;

You can do any number of conditional checks here before modifying which template gets loaded.

WordPress has several template fetching functions available already, i've used one in the example, but here's a list for quick reference...


Hope that helps..

share|improve this answer
Haven't tried using it yet (priority of this requirement got pushed down) but it appears like it should work so I'll give the accept. – Davy8 Dec 17 '10 at 22:55
Happy to help.. :) – t31os Dec 18 '10 at 10:53
Just wanted to report back that it works beautifully. – Davy8 Jan 12 '11 at 18:16

Seems like this could be done with Custom Queries.

share|improve this answer

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.