Make WordPress Core

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's profile 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)

26733.patch (591 bytes) - added by bcworkz 11 years ago.

Download all attachments as: .zip

Change History (4)

@bcworkz
11 years ago

#1 @bcworkz
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

The author name comes from user_nicename, which by default is the same as user_login, which is not allowed to have accents/diacritics. There is not any way in the default installation to alter user_nicename. It can only be done by plugin or directly editing the DB. So not running user_nicename through remove_accents() is not a bug.

Since users could innocently alter user_nicename, it's not unreasonable to enhance get_author_posts_url() to remove any possible accents.

#2 @nacin
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.

#3 @wonderboymusic
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Marked for close 20 months ago, seems like this is a plugin issue. Thanks for the report.

Note: See TracTickets for help on using tickets.