Webberhub.com Logo
webberhub.com Intro

How To Change WordPress Author URL Slug


How To Change WordPress Author URL Slug

This post show WordPress author URL slug changing by coding in functions.php and by making simple WordPress plugin. Using this you can add any name.



WordPress is the most popular content management system in the world and there are tons of website run on the WordPress CMS.

And there are many powerful thins and program also can be created by using WordPress. For that, you need to get knowledge about Developing WordPress themes and plugin (Coding with WordPress).

This post you can learn about same basic peace of code related to WordPress theme and plugin design. But, it is sometime very important.

The focus peace of code of this post is the code of changing WordPress author slug by using WordPress theme or WordPress plugin.

Note: To follow this post you need to learn basic things about WordPress design and plugin development, you can use our previous post mention at the end of this post for getting that knowledge.

If you need to change your WordPress website default author slug from https://example.com/author/name to https://example.com/profile/name.

You can use following steps.

There are two ways to change the author slug.

  • Add author slug changing code to your WordPress theme functions.php file.
  • Make a simple plugin to change author slug.

Add author slug changing code to your WordPress theme functions.php file

  • First you need to go your WordPress directory themes contain directory
  • Then find the functions.php inside your theme folder.
  • Add following code to bottom of functions.php file.
function wh_author_base() {

global $wp_rewrite;

$author_slug = ‘profile’; // change slug name
$wp_rewrite->author_base = $author_slug;
}

add_action(‘init’, ‘wh_author_base’);

Make a simple plugin to change author slug

  • First Create folder inside your WordPress plugin directory.
  • Create folder with the name of your required plugin name.
  • Create a .php file inside your plugin folder with your required name (it is better to same name for both plugin name and .php file name).
  • Inside following code you created .php file.

/*
* Plugin Name: WH Change Author Slug
* Plugin URI: https://webberhub.com
* Description: This is a simple plugin to change author slug.
* Author: Nirosh Webber
* Author URI: https://webberhub.com
* Version: 1.0.0
**/

function wh_author_base() {

global $wp_rewrite;

$author_slug = ‘profile’; // change slug name
$wp_rewrite->author_base = $author_slug;
}

add_action(‘init’, ‘wh_author_base’);

Make a simple plugin to change author slug

 

Now you can go to and active your new made plugin using WordPress admin panel.

If you need in-depth knowledge of creating a WordPress plugin follow our post of Guide to develop premium WordPress plugin to earn tons of Money.

Also, you need get knowledge of design WordPress website. Can follow our post of Complete Guide to Create Website using WordPress by Yourself.

Conclusion

Here, we discuss about the way of changing WordPress author slug. It can don only two ways. These are Make changing your WordPress theme functions.php file and design your own simple WordPress plugin.

If you get stuck using this guide of changing WordPress author slug, don’t hesitate to contact me or comment in the comment section – I’ll help to sort this out.


Related Posts..