Change author & pagination base in WordPress

The pagination base for archive pages is set to "/page/" whereas the author permalink base is set to "/author/". Both of these bases can be changed if necessary. Continue reading to find out how to do so in a few simple steps.

If you are looking at this post, it is likely that you have been searching for a way to change the endpoints that are used for archive pages. There are a number of scenarios in which you will want to or need to modify them. For example, it may be beneficial to translate either the author or the pagination base to match the language of your website.

Unfortunately, there is no easy method for users to alter it directly from the administrator panel in WordPress. To get it working, all you need to do is add a PHP snippet to your WordPress page which requires just little coding skills.

How to change the rewrite bases?

Use the two code snippets provided below to update the rewrite bases for the author archive and pagination URLs. To understand how the following code works, you must first understand what rewrite rules are. The condensed explanation is provided in the article's last section.

To use them, edit the following code snippets to your needs and put them into the functions.php file in the (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 adjust them, you will need to make WordPress flush the rewrite rules to apply the changes. Otherwise, you may see a 404 error while browsing the archive sites.

How to change pagination base?

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

Sample archive permalink before the change:

Sample archive permalink after the change:

How to change author base?

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 before the change:

Sample author permalink after the change:

What are the rewrite rules?

The rest of this post is for you if you have no idea what rewrite rules are. 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.


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.

Pagination base and other rewrite rules
The rewrite rules with pagination basis form only a tiny part of the entire rewrite rules array.

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.
by Maciej Bis

Leave a Reply

Your email address will not be published. Required fields are marked *