You can use the API function permalink() to get the permalink/profile URL for any user. This helps you integrate/replace author link in your theme with profile URL, or change author link in comments to profile URL.
You must define a global If you’re going to use any API function like this:
Now, lets get the permalink for user ID 22
As simple as that. Now lets say that you want to show/get the permalink of logged in user dynamically and not have to enter a custom ID, you would do this:
Very simple. This way you can generate profile permalink automatically for your users dynamically by using the above API method.
Note: If you want to return this permalink in comments, get_current_user_id() won’t work! You need to get the commenter ID via $comment->user_id if the commenter is an existing user.
$profile_url=$userpro->permalink( $comment->user_id );
Leave A Comment?