简体   繁体   中英

Way to change the author permalink in wordpress?

I am currently viewing members details using author.php - it all works perfectly but i want to change the /author permalink to /member. Ive done this but it takes me to a 404 page now.

 add_action('init','change_author_permalinks');  
 function change_author_permalinks()  
 {  
      global $wp_rewrite;  
      $wp_rewrite->author_base = 'member'; // Change 'member' to be the base URL you wish to use  
      $wp_rewrite->author_structure = '/' . $wp_rewrite->author_base. '/%author%';  
 }  

Login and go to the dashboard.

Then go to Settings > Permalinks and save the page. That flushes the rewrite rules and should then take you to the correct page when entering the new URL.

You could also use flush_rewrite_rules() but you should use that function sparingly and only when you need to. Saving the Permalinks page is the easiest way to go so you're not flushing the cache constantly.

Great plugin: https://wordpress.org/plugins/edit-author-slug/

This plugin works great. but some things you can do without a plugin. Here is a perfect solution without a plugin, check it out this article . It is working fine for me.

This plugin may help: https://wordpress.org/plugins/edit-author-slug/

I used on several sites and never had an issue ;)

Be sure to save your permalinks (Settings > Permalinks) after any slug update.

I actually just built a plugin to address this very issue. It allows you to change the author url to anything at all. It effectively changes the link shown on the posts, and also redirects any old author pages. Can be specified per user or globally.

https://wordpress.org/plugins/wp-custom-author-url/

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM