How to Change Author Slug in WordPress and Use Custom Author Slug

WordPress

If I use the word ‘slug’, it means I am talking about the URL structure. Slug is the URL just after the domain name. In WordPress, we also say it permalink. In WordPress, the default author slug is something like this:

http://example.com/author/username

Best Managed WordPress Hosting

WPEngine is the best and most secure managed hosting provider

Here username is the username of that author on the website. This page displays all posts of that author. A few themes also come with a bio at the top of posts on author pages. If you have a WordPress-based blog, you can use this URL to access the author page of any user just by adding a username at the last. And there is no way to change the permalink structure of author archives. WordPress only allows users to change post archives and use a custom URL base. What if you want to change the permalink structure of author pages? See a possible URL below that you could want to have on your website for authors.

http://example.com/profile/username

In this post, we are listing a few plugins and code snippets for using a custom author slug in WordPress.

1. Plugin Method:

The most simple method of changing the author archive slug is the use of plugins. Edit Author slug is a simple plugin. Install the plugin and then visit the plugin settings page (Settings > Edit Author Slug). Here, enter the new author base slug which you want to use.

You can change this to look like this

http://example.com/profile/username

Change Author slug WordPress

You can see the above screenshot. The plugin also lets you set the Author page slug based on user roles.

2. Code Snippet

You can also change the author slug manually by adding the following code in functions.php of your WordPress theme.

add_action('init', 'change_author_base');
function change_author_base() {
    global $wp_rewrite;
    $author_slug = 'profile'; // change slug name
    $wp_rewrite->author_base = $author_slug;
}

The above code will change the default author slug to profile. You can modify the above code to use what you want to add in the author slug.

Changing author base slug will never affect the search engine ranking of your website. It is also recommended not to index your archive pages. It may lead to duplicate content issues.

If you have anything to ask, you can comment below.


Deepanker Verma is an experienced WordPress developer who has been working on WordPress for more than 12 years. On TheWPGuides, he writes about WordPress, WordPress development, and WordPress plugins.


Similar Articles

0 Comments

Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

© 2022 The WP Guides Developed By Deepanker