In wordpress some people wants to create the community site and they want to create uniqe url for each user. In that time you need to remove the author word from wordpress permalink. Normally when we want to see the author URL then you can see URL as follows.
Remove author word from wordpress permalink
http://website.com/author/username/
If you can want to change the url to following
http://website.com/username
then you just need to edit only .htaccess file. Put following line in that file
RewriteRule ^author/(.+)$ http://www.yourblog.com/$1 [R=301,L] // change yourblog to website name
If you dont want to change the .htaccess file and still want to change the permalink structure then open the functions.php file from you wordpress theme folder.
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; } 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; }
How do i change it to where the users nickname is showing in the permalink instead of the login name? this is mainly for security purposes. your code word perfectly anf thanks for hack.
go to wordpress admin and left side you will find the users tab. Select the user and change the nickname as you need.
did you modified the .htaccess file also. If not then this code will never work. Other wise give me more details…so I can help