Override default url for author pages?

So the default url to display a list of posts by a particular author looks like this:

http://domain.com/author/{username}

I am wondering how to change the ‘author’ in that url to something else?

I am working on a website for a charter school and they would like to allow each teacher to have a list of posts by “classroom”. So the desired url would be

http://domain.com/classroom/{username}

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You might wish to try..
http://wordpress.org/extend/plugins/custom-author-base/

Hope that helps.. 😉

Method 2

You can add this in your functions, and it will rewrite the slug from default “author” to “classroom”,

function new_author_base() {
    global $wp_rewrite;
    $author_slug = 'classroom';
    $wp_rewrite->author_base = $author_slug;
}
add_action('init', 'new_author_base');

hope it helps you

Method 3

I use “Edit Author Slug” plugin for doing the same on my http://www.techcartnow.com/author/kapil-khandelwal/ WordPress Blog. I have modified “author slug” using this plugin.

Edit Author Slug” plugin allows you to change both the author base (the ‘/author/’ portion of the author URLs), and the author slug (defaults to the username of the author).

Method 4

You can add this in your functions.php:

global $wp_rewrite;
$wp_rewrite->author_base = "member"; // or whatever
$wp_rewrite->flush_rules();


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments