I’m curious if its possible (and advisable) to change certain directory names and URL structure via customization by themes or plugins. For example, say I wanted the list of all a user’s posts to appear at blog.com/people/username instead of at blog.com/author/username…is this possible via customization? If so, would this type of customization be very problematic when it comes to things like forward compatibility with the latest WP updates and such?
Any advice anyone can offer on this would be most appreciated.
Thanks.
Eddie
@kureikain’s answer looks great, and it probably works really well in a wide variety of circumstances.
But for author URLs specifically, there’s a simpler way. Change the author_base, like so:
You should only need to run this once, perhaps on a plugin activation. Updating WordPress should not affect this solution.
EDIT
As @Jan pointed out in the comments, you need to run this on every init. But you only have to flush the rules once.
You can use filter generate_rewrite_rules to add new custom url! The first, you add filter to create url! Second, you add new function to handle that URL (display wordpress profile in this case)
That way when someone go to people/kureikain, wordpress will make it become index.php?pagename=people&username=kureikain
Then you createa a new page and make its slug to people! Next you create a new custom page template to display that profile!
Beside, we add a new query var, username to above code! We need to let wordpress knows about it
In your code, to get username, you must call
$username = get_query_var(‘username’);
That’s all!
In my opinion it looks like the only thing you actually need is to change the author base, which this plugin will do for you(basically the same as what MathSmath posted, but in a glorified plugin form).
http://wordpress.org/extend/plugins/custom-author-base/