Ready to get started?Download WordPress


Change Author slug (5 posts)

  1. eric34
    Posted 8 months ago #

    Hi !

    I would like to change the public author page from : sitename.com/author/nickname to sitename/author/ID

    Any idea how I could do that?

    Thanks !

  2. georgechr
    Posted 8 months ago #

  3. eric34
    Posted 8 months ago #

    Hi! No it doesn't.

    That may change the "base slug" but this is not the "author" I want to change but the "nickname" !

  4. georgechr
    Posted 8 months ago #

    ok :) if i find something i wrote it here!

  5. bcworkz
    Posted 7 months ago #

    Intercept the query at the 'parse_query' action. Verify that $query->is_author is true. The ID from the URL will be in the query var 'author_name'. WP hasn't yet figured out the query var is not a valid author name. Use the ID to get the actual user_nicename and set the 'author_name' to the actual nice name value.

    The result is the usual author archive page, but accessed using author's user ID. Unless you build in logic to detect the ID integer before getting the userdata, providing the normal nicename in the URL will cause an error.


You must log in to post.

About this Topic


No tags yet.