free site statistics

How To Change WordPress Author URL Slug

Published 4 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

Create a CV - Free Latest CV Formats / BIO DATA / CV Templates

Create a CV - Free Latest CV Formats / BIO DATA / CV Templates

Published 6 years ago by LankaTricks

When you are seeking a full-time job or freelance job then a good professional looking resume or CV is the important thing for pass the interview correctly. Because, The interview panel first time identify you by using your resume or CV. A Correctly designed resume/CV with good content adds that final bit of polish to…

Tutorials
Fundamental Insurance Equation - Actuarial Techniques Part 03

Fundamental Insurance Equation - Actuarial Techniques Part 03

Published 6 years ago by LankaTricks

This is the third lesson of actuarial techniques. This part also discuss another terms of Fundamental Insurance Equation. if you don’t read second parts of this lesson. you can learn by using following link. The basic economic relationship for the price of any product can be given as follows: Price = Cost + Profit This…

Knowledge
Buddhist History and Culture Paper - 2011 Dharmacharya Exam

Buddhist History and Culture Paper - 2011 Dharmacharya Exam

Published 5 years ago by LankaTricks

  Buddhist History and Culture Paper – 2011 Dharmacharya Exam Considering the Buddhist learning place in Sri Lanka, Daham Pasal is the best place to provide that knowledge to student. So, The vary impotent exam of Daham Pasal is dharmacharya exam and also this examination result prioritize the people to giving government job also. In This…

Daham Pasal ExamDharmacharya examE Thaksalawa
Introduction to Electronics - Electronics Definition

Introduction to Electronics - Electronics Definition

Published 6 years ago by LankaTricks

In this tutorial you can learn basic definitions about electronics Such as Electronic, Active Devices, Passive Devices,Current, Direct Current,Alternating Current, Frequency, Voltage, Resistance etc. Definition of Electronics Electronics is the branch of science that deals with the study of flow and control of electrons and the study of their behavior and effects in vacuums, gases,…

Knowledge
Digital Logic and Transistor - O/L ICT Tutorial part 05

Digital Logic and Transistor - O/L ICT Tutorial part 05

Published 6 years ago by LankaTricks

  ICT is the short form of the Information and Communication Technology and This is vary impotent subjects in present and It will be more useful for future times. So These ICT Tool and Techniques use in every industry and each and every works. In this post  brings to you the second lesson of Ordinary…

O/L TutorialsTutorials
ICT - 2017 Advanced Level Exam Paper (Sinhala Medium)

ICT - 2017 Advanced Level Exam Paper (Sinhala Medium)

Published 5 years ago by LankaTricks

ICT – 2017 Advanced Level Exam Paper (Sinhala Medium) Considering the All Subject Stream of Advanced Level Examination in Sri Lanka, Information and Communication Technology is the one of Major subject which can follow by the Students and also This is available for study with any subject stream. The Meaning of ICT as follows ICT…

A/L Pass PapersA/L TutorialsE ThaksalawaICT