How to Convert Author Permalinks to Social-Style Handles?

In WordPress, author archive pages use the /author/ base in their URLs. While functional, this format is somewhat old-fashioned. Many social networks now use a cleaner style, where profile URLs start with an @ followed by the username.

You can see this on platforms like X and Instagram, where user profiles follow a simple, handle-based format. The @ prefix is now widely recognized as a way to point to user profiles.

If you want your WordPress author URLs to look more consistent with this pattern, you can adopt the same format for them in just a few minutes.

Author URL with @ handle

How to Convert Author Permalinks to Social-Style Handles?

What the Snippet Changes

How WordPress structures author URLs in its backend code involves several layers of logic. A detailed breakdown would make this unnecessarily complicated.

Simply put, $wp_rewrite controls the permalink system, and its author_structure property sets the format for author archive URLs.

By default, this is set to:

/author/%author%

The code below simply replaces the /author/ part in that structure with @ symbol to:

/@%author%

As a result, WordPress generate author URLs like:

https://your-site.com/@alice

Code Snippet

You can do this without any extra plugin. All it takes is a short snippet of code.

If you are not sure how to add it, this article shows all the ways you can insert custom code snippets in WordPress.
function pm_change_author_base() {
	global $wp_rewrite;
	$wp_rewrite->author_structure = '/@%author%';
}
add_action('init', 'pm_change_author_base', 10);

Handling Old Author URLs

Changing the author URL structure breaks any existing links that still point to /author/username.

Remember, this change affects every author URL. Make sure the old links redirect to the new ones. If you skip this, indexed URLs could lose traffic, which might hurt your SEO.

You can handle this by adding a redirect function. It will catch requests to the old URLs and redirect them to the updated format.

function pm_redirect_old_author_urls() {
	global $wp;
	if (is_404() && preg_match('#^author/([^/]+)/?$#', $wp->request, $matches)) {
		$author_slug = $matches[1];
		$new_url = home_url('/@' . $author_slug);
		wp_redirect($new_url, 301);
		exit;
	}
}
add_action('template_redirect', 'pm_redirect_old_author_urls');

Flushing Rewrite Rules and Testing

After pasting the code, open "Settings -> Permalinks" and click "Save Changes". This forces the rewrite rules to update, so your author URLs follow the new structure.

Save changes to flush rewrite rules

Posted by Maciej Bis on: .


Maciej BisFounder of Permalink Manager & WordPress Developer

The developer behind Permalink Manager, a plugin for managing permalinks, has been working with WordPress, creating custom plugins and themes, for more than a decade.

Leave a Reply

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