I have a website where users can register, login and their edit profile, they can comment but not post.

What I am looking for is a way to display a user profile page (where I display the gravatar and the info about the user) clicking on the username. The url must be something like "www.mywebsite.com/user/username".

I know about author.php, but I don't know how to link even if the user has no posts and is not an author.


I managed to solve it. Instead of linking using <?php the_author_posts_link(); ?> I did an href linking to www.mysite.com/user/<?php echo $user_info->display_name; ?>

To rename the slug I installed the Edit author slug plugin, it makes the author slug editable under Settings > permalinks.

To customize the user profile, just edit authors.php as you like.

1 Answer 1


Every registered user can have profile, they don't need to have posts.

To change Wordpress author's profile permalink, paste the following code in your functions.php:

function change_author_permalink_base() {
    global $wp_rewrite;
    $wp_rewrite->author_base = "user";
add_filter( 'init', 'change_author_permalink_base' );

After pasting the code, visit Settings->Permalink Structure under your wordpress admin, to flush the rewrite rules. This is a required step, otherwise you may get 404 on author profiles.

Then code your author.php. As far as linking is concerned this is totally your design decision. If you want to link the profiles from user's comment, you can either add the new link or just link comment author name to their profile.

Remember the profile is available only if the user is registered as Wordpress user.

  • I found how to do it (see "update") but with your code I can now remove the "edit author slug" plugin. Thanks!
    – Andycap
    Commented May 13, 2011 at 11:04
  • Yes, I saw it after I posted. Glad you were able to find it your self. :) Commented May 13, 2011 at 11:53
  • Thank you for this code. I cannot figure out how to have different slugs for different languages? I use polylang for my multilingual wordpress site. I defined slug rewrite instead of author to be "worker", but for Croatian language I need "radnici". So when on some worker's page (en/worker/name) visitor clicks on Polylang's language switch to Croatian he isn't taken to hr/worker/name but to hr/radnici/name. Commented Feb 22, 2022 at 11:48
  • @VesnaMačković you can't ask for Polylang help here, you need to ask in a polylang community or via their support, 3rd party plugin dev support is off topic here and not in this stacks scope
    – Tom J Nowell
    Commented Feb 23, 2022 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.