How to Change Author Slug Base in WordPress?

Are you looking for a way to change the author slug base in WordPress?

By default, WordPress generates SEO friendly URL structure fetched directly from the post heading. These URLs are known as permalinks in WordPress. You can also edit the post, page, and category slugs.

Why Change Author Slug Base in WordPress?

Changing the author slug base in WordPress can have several benefits, depending on your needs. Here are a few reasons why you might want to change the author slug base:

1. SEO Optimization

  • Improved URL Structure: Changing the author slug base helps you create a more SEO-friendly URL structure, which results in improving your site’s visibility in search engines.
  • Keyword Inclusion: The inclusion of relevant keywords in your author slug helps search engines understand the content and context of your author pages in a better way.

2. Branding and User Experience

  • Consistency: Changing the author’s slug base to match your website’s branding or URL structure provides a more professional and consistent appearance.
  • User-Friendly URLs: User-friendly URLs are easier to read and remember, which can enhance the user experience.

3. Security

  • Obfuscation: Changing the author slug can help obscure user information, making it slightly harder for attackers to guess usernames based on author URLs.

4. Customization

  • Tailored URLs: Customizing author slugs allows you to tailor the URLs to better fit the content and focus of your website. For instance, if your site is focused on guest authors, you might change the slug to “guest-author.”

Code Snippet to Change Author Slug Base in WordPress

WordPress doesn’t have an option to edit the author slug. So, if you want to change the author slug base to a customized slug, you can use the below code snippet.

php
/**
 * Change Author URL Slug & Base in WordPress
 */
function maverick_change_author_slug_base()
{
    global $wp_rewrite;
    
    $author_slug = 'profile'; // change slug name
    
    $wp_rewrite->author_base = $author_slug;
}
add_action( 'init', 'maverick_change_author_slug_base' ); 

Leave a Reply

Your email address will not be published. Required fields are marked *