Change author & pagination base in WordPress

In this short article, you will learn how to customize both the pagination and the author permalink formats in WordPress.

As you may have seen, the default pagination base for archive pages is “/page/“. Simultaneously, the author permalink base is set to “/author/“. Unfortunately, WordPress does not give a convenient way for users to change it directly from the administration panel.

You may need to update the rewrite bases for a variety of reasons. For example, it may be advantageous to translate either the author or the page into your own language.

What are the rewrite rules?

Before we get into how to modify author and archive permalinks, we should first define rewrite rules. The rewrite rules are, for the most part, URL patterns that WordPress uses to determine what content type should be loaded when a given URL is requested.

Each post type, taxonomy, and archive type has its own rewrite rule to distinguish itself from the others (permalink pattern). Of course, this is also true for author permalinks.

In order to better understand how they work, let us look at an easy example. As previously stated, author pages also have “rewrite rules” which are as follows.

author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$
author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$
author/([^/]+)/page/?([0-9]{1,})/?$
author/([^/]+)/?$

As you can see, they are built on regular expressions (REGEX). Each of them is a pattern that contains capturing group and text strings. The patterns shown above feature three distinct capturing groups:

  • ([^/]+) is used to get the author slug (eg. john-doe) from requested URL
  • (feed|rdf|rss|rss2|atom) is used to get the feed type (eg. feed) from requested URL
  • ([0-9]{1,}) is used to parse the page number (eg. 2) from requested URL

They also include two rewrite bases that we have the ability to modify.

  • author
  • page

These raw patterns will be used by WordPress to generate the author archive permalinks, which will look like this when they are generated.

https://example.com/author/john-doe/feed/rss/
https://example.com/author/john-doe/feed/
https://example.com/author/john-doe/page/2/
https://example.com/author/john-doe/

How to change the rewrite bases?

Now we can get to the point. To update the rewrite bases for author archive and pagination URLs, see these two code snippets below. Please keep in mind that every time you adjust them, you will need to make WordPress flush the rewrite rules to apply the changes.

This feature is not available in Permalink Manager, so to use it you will need to customize the following code snippets & paste them to functions.php file in (child) theme directory. Please read this article if you do not know how to use code snippets in WordPress.

Please keep in mind that every time you update them, you will need to force WordPress to flush the rewrite rules in order for the changes to take effect.

The pagination base (all archive permalinks)

Sample archive permalink before the change:

https://example.com/2019/10/page/2/
https://example.com/news/page/2/
https://example.com/shop/apparel/shirts/page/2/

function pm_change_pagination_base() {
global $wp_rewrite;
$wp_rewrite->pagination_base = 'seite';
}
add_action('init', 'pm_change_pagination_base');

Sample archive permalink after the change:

https://example.com/2019/10/seite/2/
https://example.com/news/seite/2/
https://example.com/shop/apparel/shirts/seite/2/

The author base (author archives)

Sample author permalink before the change:

https://example.com/author/john-doe/
https://example.com/author/jan-kowalski/
https://example.com/author/ola-nordmann/

function pm_change_author_base() {
global $wp_rewrite;
$wp_rewrite->author_structure = 'user/%author%';
}
add_action('init', 'pm_change_author_base', 10);

Sample author permalink after the change:

https://example.com/user/john-doe/
https://example.com/user/jan-kowalski/
https://example.com/user/ola-nordmann/

How to flush the rewrite rules?

To flush the rewrite rules, you will need to login to your WordPress admin account and go to “Settings -> Permalinks” section. After you are there, you need to click on “Save Changes” button. The rewrite rules will be flushed and the new rewrite bases applied to either/both archive pagination & author page URLs.

Flush rewrite rules
The rewrite rules can be flushed in Permalink settings.

2 responses to “Change author & pagination base in WordPress”

    • Thank you for your comment. Indeed, the author slug snippet was no longer functional. The text now includes the updated corrected snippet.

Leave a Reply

Your email address will not be published.