Basically, you need to add WP rewrite rules to match the names of each of your users in the desired form. This is what WP No Category Base is for categories, so most of the code in my answer is adapted from this plugin.
The main part of the plugin is a function that connects to the author_rewrite_rules filter and replaces the author’s rewrite rules. This extracts all user names and adds a rewrite rule specifically for each user (feeds are not processed below, so if you need this, look at the source of the WP No Category database).
add_filter('author_rewrite_rules', 'no_author_base_rewrite_rules'); function no_author_base_rewrite_rules($author_rewrite) { global $wpdb; $author_rewrite = array(); $authors = $wpdb->get_results("SELECT user_nicename AS nicename from $wpdb->users"); foreach($authors as $author) { $author_rewrite["({$author->nicename})/page/?([0-9]+)/?$"] = 'index.php?author_name=$matches[1]&paged=$matches[2]'; $author_rewrite["({$author->nicename})/?$"] = 'index.php?author_name=$matches[1]'; } return $author_rewrite; }
Another key part of the plugin is a function that intercepts the author_link filter and removes the author database from the returned URL.
add_filter('author_link', 'no_author_base', 1000, 2); function no_author_base($link, $author_id) { $link_base = trailingslashit(get_option('home')); $link = preg_replace("|^{$link_base}author/|", '', $link); return $link_base . $link; }
See this entity: http://gist.github.com/564465
This does not handle redirection from the URLs of the old style authors, again, see the WP No Category Base source if you need to do this.
Richard M
source share