How to get WordPress user profile URL

This article explains how to get the user profile URL in WordPress by using the author ID. We use a simple function that is used for getting the user profile URL in WordPress.

One of the major benefits of using WordPress for creating a website is that WordPress comes with a user creation and management system out of the box. This allows you to have user registration and user profiles without having to build any of the functionality by yourself. If you are creating some custom functionality for your users, you might need a way to link directly to a specific user profile. For this, you will need a way to get the WordPress user profile URL programmatically.

wordpress user profile url

What is your WordPress public profile URL?

WordPress user profile URL is a standard URL address that links to the profile of a specific WordPress user. Usually looks something like this:

https://example.com/author/username/

The WordPress profile URL is used by WordPress plugins and WordPress theme developers to provide a way to directly link to the specific user profile.

How to get WordPress user profile URL

To get the user’s profile link we can use the “get_author_posts_url” function. The get WordPress user profile URL is a core feature that allows you to get the link of any registered users in your website. This function returns the URL to the author page for the user with the user ID that we provide. The function requires the $author_id parameter and optionally you can also pass the $author_nicename like this:

When you run the above function, WordPress will return the URL for the user profile page of the specific author.

If you want to display the WordPress profile URL for the same author on your WordPress site, you can do it with the following code:

output: https://example.com/author/username/

By default, WordPress allows you not to only create profile pages but also to let people edit their profiles. This is done via the WordPress dashboard. Alternatively, there’s a way to allow users to edit their profiles directly from your website.┬áThis is known as ‘Frontend user profiles’.

Conclusion

In this article, we have learned how to get WordPress user profile URL with code. We have also shown how to display the user profile URL to logged in users as well as all WordPress users. We hope that will find this article useful and that you now know how to link to a user profile in WordPress.