Add `authorBase` option to WP Source package


There is an option to set a custom structure for permalinks in WordPress’ admin panel (Settings > Permalinks > Common Settings). This structure not only affects to posts but also categories, tags and authors. The only type of entity that is not affected are pages.

Screenshot from 2020-04-22 18-07-29

For example, when using the custom structure in the image, author URLs whould be something like /blog/author/admin, thus breaking the current implementation for the author handler.

To solve this, the idea is to add a new setting in this page like the ones we already have to change the category and tags base link.


As a Frontity user
I want to change authors link base in the configuration
so that I can make Frontity work with custom permalinks for authors.

Possible solution

Initial proposed solution (click to open)


This could be solve using the same implementation we did for categoryBase and tagBase. We just have to add an authorBase option in state.source:

and handle that option the same way we are doing for the others already mentioned:

Final implementation

Final implementation

The solution was the same used for categoryBase and tagBase: to create a redirection in the init action based on a setting in state.source called authorBase.

const WpSource = {
  actions: {
    init: ({ state }) => {
      const { authorBase } = state.source;
      if (authorBase) {
        // Add new direction.
        const pattern = concatPath(subdirectory, authorBase, "/:subpath+");
          name: "author base",
          priority: 10,
          func: ({ subpath }) => `/author/${subpath}/`,
        // Remove old direction.
          name: "author base (reverse)",
          priority: 10,
          pattern: concatPath(subdirectory, "/author/(.*)/"),
          func: () => "",