free site statistics

How To Change WordPress Author URL Slug

Published 3 years ago by LankaTricks
How To Change WordPress Author URL Slug

WordPress is the most popular content management system in the world and there are tons of websites run on 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 some basic pieces of code related to WordPress theme and plugin design. But, it is sometimes very important.

The focus piece 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 the 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 themes contain directory
  • Then find the functions.php inside your theme folder.
  • Add the following code to the 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 a folder inside your WordPress plugin directory.
  • Create a 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 the same name for both plugin name and .php file name).
  • Inside the following code, you created PHP file.
/*
* Plugin Name: WH Change Author Slug
* Plugin URI: http://www.lankatricks.com
* Description: This is a simple plugin to change author slug.
* Author: Niroshan
* Author URI: http://www.lankatricks.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 activate your new made plugin using the WordPress admin panel.

If you need in-depth knowledge of creating a WordPress plugin follow our post of Building WordPress Plugin.

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

Conclusion

Here, we discuss 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.


– The contents we publish on this website regarding the professional and educational courses are extracted from various sources, such as newspaper advertisements, circulars, and websites. The right to this information belongs to the first owner of the information. If any alteration happens to this information, we don’t take the responsibility arising from such alteration. Instead, we do inform you as soon as possible regarding the updated information related to professional and educational courses. Also, we allow access you to gain essential knowledge related to competitive exams.

Related Posts

Genaral Knowlage - IQ - Goverment Exam Helper PDF in Sinhala

Genaral Knowlage - IQ - Goverment Exam Helper PDF in Sinhala

Published 6 years ago by LankaTricks

In this post you can get many knowledge for the General Knowledge, IQ Question and answer related to the various type of management related topics. This PDF tutorial specially design foo to get the knowledge for most of sri lanka government exams for job seekers such as SLAS,DO. The author of this PDF tutorial is…

Tutorials
Bopath Ella - Beautiful waterfall in Ratnapura District, Sri Lanka

Bopath Ella - Beautiful waterfall in Ratnapura District, Sri Lanka

Published 1 months ago by LankaTricks

Bopath Ella is a waterfall situated near Kuruwita town in the Ratnapura District. This waterfall is one of the most tourist attraction places in Sri Lanka. It is 30 meters (98 feet) high and is created by the Kuru Ganga, a tributary of the Kalu Ganga. Kuru Ganga originates from the Samanala Kanda Mountains.

Travel Destinations
Neluwa Duwili Ella Waterfall

Neluwa Duwili Ella Waterfall

Published 2 months ago by LankaTricks

Duwili Ella is located in the Neluwa Divisional Secretariat Division in the Galle District. Its height is about 25 meters. This is one of the most beautiful waterfalls in the Sinharaja Rain Forest. The Sinharaja Rain Forest consists of 19 waterfalls, and out of these waterfalls, 11 are located in the Galle District...

Travel Destinations
SLAS Exam Guide - Paripalana Sewa - Lesson 10

SLAS Exam Guide - Paripalana Sewa - Lesson 10

Published 6 years ago by LankaTricks

SLAS Exam Guide tutorial published on Dinamina Newspaper and Author of this lesson series is Anusha Gukula Pernando. and This is the Lesson 10 SLAS (Sri Lanka Administrative Service) Exam tutorials Which were published on this Dinamini Sri Lankan news paper and there are thousands of people enter in to Sri Lanka Administrative service by referring…

SLAS ExamTutorials
IQ questions with answers in sinhala PDF for Givrnment Exams n Sri Lanka

IQ questions with answers in sinhala PDF for Givrnment Exams n Sri Lanka

Published 5 years ago by LankaTricks

IQ questions with answers in sinhala PDF Considering Sri Lanka Government examinations, There are many subjects of  papers  available.But Among that General Knowledge or Samanya Danima  paper is the vary impotent paper. The reason for that is most of people who are facing these exams are have long treble about  Samanya Danima  paper. In Lankatricks.com,…

Tutorials
A/L 2013 - Communication and Media Studies Paper

A/L 2013 - Communication and Media Studies Paper

Published 4 years ago by LankaTricks

A/L 2013 – Communication and Media Studies Paper Considering the Science Subject Stream of Advanced Level Examination in Sri Lanka, Communication and Media Studies is the one of Major subject which should follow by the Students. “Communication and Media Studies is a study of how we communicate differently to various audiences/users and communities. It understands…

A/L Pass PapersA/L TutorialsAL Communication and Media StudiesE Thaksalawa