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

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



share|improve this question

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.

share|improve this answer
is this work with pagination? – Anjum Aug 16 '13 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 '13 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 '13 at 18:26
up vote 1 down vote accepted

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
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.