Opened 11 years ago
Closed 9 years ago
#26733 closed enhancement (invalid)
get_author_posts_url() is not removing accents/dicritics from the author link
Reported by: | bpmvrzsf | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.8 |
Component: | Formatting | Keywords: | close |
Focuses: | Cc: |
Description
$author_link = get_author_posts_url( get_the_author_meta( 'ID' ); echo $author_link;
and the output will be e.g.
http://example.com/author/džiga
instead of the correct:
http://example.com/author/dziga
Could this be fixed in the next version, because only http://example.com/author/dziga will lead to the correct page. http://example.com/author/džiga will lead to 404 page.
Thanks in advance.
Attachments (1)
Change History (4)
#1
@
11 years ago
- Cc bcworkz added
- Component changed from General to Formatting
- Keywords has-patch needs-testing added
- Type changed from defect (bug) to enhancement
#2
@
11 years ago
- Keywords close added; has-patch needs-testing removed
Hi bpmvrzsf, thanks for the bug report.
You're right that it's not possible to change user_nicename. But the field is actually run through sanitize_title() (you can see this in wp_insert_user()). sanitize_title() is a general utility function that in turn runs it through remove_accents(). sanitize_title() is a slight misnomer, but really it means "sanitize this to be friendly for a URL" by removing accents, adding dashes and such.
I'm not sure how your nicename ended up with an accent, but it definitely isn't possible without a plugin or DB edit. Given that remove_accents() is run, it looks like this is actually not a bug.
The author name comes from
user_nicename
, which by default is the same asuser_login
, which is not allowed to have accents/diacritics. There is not any way in the default installation to alteruser_nicename
. It can only be done by plugin or directly editing the DB. So not runninguser_nicename
throughremove_accents()
is not a bug.Since users could innocently alter
user_nicename
, it's not unreasonable to enhanceget_author_posts_url()
to remove any possible accents.