WordPress Snippets at WPcustoms

Change /author/ base url

Default permalink is yoursite.com/author/username. This function changes the /author/ page to something custom. We changed it in this example to yoursite.com/staff/username. Do not forget to re-save your permalinks after this snippet is added to flush the rewrites.


/**
 * Snippet Name: Change /author/ base url
 * Snippet URL: https://wpcustoms.net/snippets/change-author-base-url/
 */
  function wpc_new_author_base() {
    global $wp_rewrite;
    $author_slug = 'staff'; // adjust your author slug here
    $wp_rewrite->author_base = $author_slug;
}
add_action('init', 'wpc_new_author_base');