free site statistics
Tuesday , May 11 2021
Home / Tutorials / How To Change WordPress Author URL Slug

How To Change WordPress Author URL Slug

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: https://www.lankatricks.com
* Description: This is a simple plugin to change author slug.
* Author: Niroshan
* Author URI: https://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.

Improve Your Health

  • How Green Tea affect to improve your Health

    This is the Health Knowledge Lankatricks provide you. Under the Health Calgary we try to discuss various area about improve your Health. This Post discuss about Green Tea and How it effect for your health.

Knowledge

  • Benifits Of Free Website Building Tools

    The internet is becoming a bigger. It’s an important platform used to access anything and connect with others. Websites are the way to gain presence online and with the boom witnessed, website building has become

  • Why people make Click Fraud Farm? Is it legal?

    In the recent past, Over 400 mobile phones, 17,000 SIM cards and 60 routers have emerged as a hot topic in Sri Lanka. There are many complained for that it was Click Farm, while another

  • The biggest interview mistakes to avoid

    This article is also a Lanklatricks.com another guide about career advice. This guide discuss happening mistakes when people facing interview. By avoiding these mistakes you can face interview correctly.   The biggest interview mistakes to

  • Auto Insurance Basic Introduction

    In this post we are going to discuss about basic things of auto insurance. and this article help for the learners of the insurance and also people who are willing to get a auto insurance.

  • International Banking Tutorial

      (01) Explain the off balance sheet activities in domestic and international banking the way to impact to the profit & loss. An asset or debt that does not appear on a company’s balance sheet.

  • Link Building, Backlink, The Benefits Of Building Links – SEO 2018 New

    Link Building When considering search engine optimization link building is the one of major part it. In this guide of Lankatricks you can learn about what the link building is and How it is affected

  • How to make Sri Lanka PayPal account receive money – Part 02

    Making Sri Lanka PayPal account. This is the second part of making PayPal account. This part you can continue the process of making PayPal  account for Sri lanka Peoples. At the end of this part

– The things we publish in this website are relating to the job information and information relating to the professional courses, which are extracted from various sources such as various newspaper advertisement,circulars and Various websites. The right of these information belongs to the first owner of the information. If any alteration happen these information, we don’t take the responsibility arising arising from such alteration. Instead, what we do is to inform you as quickly as possible regarding the information related to the job opportunities and model applications and professional courses. as well as we allow you to gain essential knowledge related knowledge related for the competitive exams.

Check Also

Digital Logic and Transistor – O/L ICT Tutorial part 03

  ICT is the short form of the Information and Communication Technology and This is …

Open

Lankatricks Exam Help

Close
error: You do not allow to Copy content or View source..!!