Say that get_author_posts_url(1)
return the following URL
Passing the $author_nicename
will change this. So get_author_posts_url(1, 'foo')
will result in
You can also check this in the source code of get_author_posts_url()
.
So what does passing the second argument do? It changes the resulting URL. If you don’t provide further mechanisms, this will probably result in invalid URLs.
Why is this provided? No idea.
Ok, so checking this file via Git blame turns out, get_author_posts_url()
was previously called get_author_link()
(this change happened on Aug 30, 2006). get_author_link()
was added on Mar 19, 2004 and required the argument $author_nicename
(though it had a fallback).
Why is this provided? Because in earlier times, you needed to pass the (correct) nicename for this to work.