How To Change the Author Link in WordPress

by

In this quick tutorial, you’ll learn how to change the author link in WordPress. Consequently, you’ll be able to link to any page when a user clicks on the author’s name.

Why Change the Author Link?

In some cases, the author link at the top of a blog post redirects to the home page. This odd redirection is actually not default behavior. In fact, the Yoast SEO plugin is the culprit. You see, when you disable the author archives feature, Yoast sets up a redirect from the author link to your home page.

Yoast SEO configuration wizard multiple authors archives
Disabling author archives in Yoast SEO consequently redirects the author link to the home page

Wether that’s the case for you, or you simply want to link to a specific page, this can be accomplished with a few lines of custom code.

How To Change the Author Permalink in WordPress

Typically, the author permalink in WordPress looks something like this:

https://example.com/author/tony/

While redirecting this link to another page is an option, this isn’t good SEO practice. Instead, let’s add come custom code to link directly to a specific page.

The following code snippet links the author’s name to the about page.

// Link author name to about page
add_filter( 'author_link', 'my_author_link' );
function my_author_link() {
    return home_url( 'about/' );
}

It is recommended that you create your shortcode within a child theme. If you are using GeneratePress, I have a tutorial that walks you through the very easy process of installing a child theme.

Another option is to use a plugin like Code Snippets which allows you to run PHP code on your website. You never want to edit your theme directly as this comes with a risk of breaking things. It’s much safer to use a plugin or work within your child theme instead.

Save your changes and test it out! Now the author link takes you directly to the about page.

The code snippet above can obviously be modified to link to any page replacing the value inside home_url. For example, if your about page is at https://tonyteaches.tech/who-is-tony/ you can make the necessary changes to the code snippet.

If you have any questions about changing the author link in WordPress, let me know in the comments below. I know a lot of times, bloggers are a bit timid to add code to their website. Don’t worry, if you follow the steps above, I assure you that you won’t break anything.

If you found this blog posts valuable, subscribe to my YouTube channel for all my latest WordPress video tutorials and walkthroughs. My goal is to help website owners like you avoid having to pay thousands of dollars to hire a web developer though my free content.

About The Author

With a strong software engineering background, Tony is determined to help as many people as possible start their online busines. Discover why Tony quit his hedge fund job to pursue this mission. You can send Tony a message here.

Leave a Comment