How can I display an authors archive by author id instead author slug like




2 Answers 2


You can accomplish this with the following rewrite rule ( you'll want to add this in your functions.php


Be aware that you might need to flush your rules for it to become active. You can do this with rewrite plugin.

  • is this work with pagination?
    – Anjum
    Aug 16, 2013 at 18:03
  • and can i wrap this in a function and hook it in author_rewrite_rules like this // add our custom rewrite rules for user data add_action('author_rewrite_rules', 'my_author_rewrite_rules'); function my_author_rewrite_rules($author_rules) { $author_rules['author/([0-9]+)/?$'] = 'index.php?author=$matches[1]'; return $author_rules; }
    – Anjum
    Aug 16, 2013 at 18:05
  • with your rewrite rule pagination is not working, giving me 404 error when i am navigating to /page/2/ or so on.
    – Anjum
    Aug 16, 2013 at 18:26

after investigation into wp rewrite rules for author and with help of @Mark Davidson everything is now working perfect author archives pagination and feed rss atom etc.

below is the code which i have created and pasted here to help others, Thanks Mark Davidson for providing a pattern.

// add our custom rewrite rules for author archives
add_action('author_rewrite_rules', 'my_author_rewrite_rules');

function my_author_rewrite_rules() {
    $author_rules['author/([0-9]+)/?$'] = 'index.php?author=$matches[1]';
    $author_rules['author/([0-9]+)/page/?([0-9]{1,})/?$'] = 'index.php?author=$matches[1]&paged=$matches[2]';
    $author_rules['author/([0-9]+)/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?author=$matches[1]&feed=$matches[2]';
    $author_rules['author/([0-9]+)/feed/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?author=$matches[1]&feed=$matches[2]';
    return $author_rules;

this function will totally replace the author rewrite rules, if anyone want to add new rules and don't want to replace existing then he/she need to supply $author_rules argument in function like.

function my_author_rewrite_rules($author_rules) {
   // new rules here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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