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 a site that will have some custom roles (capabilities), and I would like to have archives that list authors based on their role.

authors.php list the profile of one author, but there is no template for listing authors, right?

Is a custom template the only way to do this? I would rather not have empty pages that just serve as holders for my archives.


share|improve this question
up vote 0 down vote accepted

You may be able to abuse add_rewrite_endpoint for this purpose, depending on exactly what you want to do.

Some examples:

// add an endpoint
// http:domain.com/role/
// http:domain.com/role/foo/ 
function wpa_add_role_endpoint(){
    add_rewrite_endpoint( 'role', EP_ALL );
add_action( 'init', 'wpa_add_role_endpoint' );

// check if a role parameter exists, like:
// http:domain.com/role/foo/
function wpa_role_query( $query ){
    if( $query->get('role') ){
        echo $query->get('role'); // echoes 'foo'
        // modify the query $query->set( 'somevar', 'someval' );
add_action( 'pre_get_posts', 'wpa_role_query' );

// check if role is in query vars array, like:
// http:domain.com/role/
function wpa_role_parse( $query ){
    if( array_key_exists( 'role', $query->query_vars ) )
        die('role query');
add_action( 'parse_request', 'wpa_role_parse' );
share|improve this answer
Thanks, I'll give this a try. – coopersita Mar 19 '13 at 14:38

Today, wptuts posted an article about exactly this:


share|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – s_ha_dum Mar 19 '13 at 14:56

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.