Override default url for author pages?
-
16-10-2019 - |
Question
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}
Solution
You might wish to try.. http://wordpress.org/extend/plugins/custom-author-base/
Hope that helps.. ;)
OTHER TIPS
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
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).
You can add this in your functions.php
:
global $wp_rewrite;
$wp_rewrite->author_base = "member"; // or whatever
$wp_rewrite->flush_rules();