Make WordPress Core

#57980 closed defect (bug) (duplicate)

"sanitize_title_with_dashes" function trims dashes incorrectly

Reported by: dam6pl's profile dam6pl Owned by:
Milestone: Priority: normal
Severity: minor Version: 6.1.1
Component: Query Keywords:
Focuses: Cc:

Description

Hello,

I noticed that the "sanitize_title_with_dashes" function when parsing the query removes the dashes from the beginning and end of the page slug, resulting in all the URLs below displaying the same page:

  1. http://example.com/sample-page/
  2. http://example.com/sample-page---/
  3. http://example.com/---sample-page----/

This creates problems in terms of SEO, because several pages, under different URLs, present the same page content.

I'm fully aware that changing this behaviour might break something, but maybe adding a filter to prevent it is a way?

Thanks!

Change History (1)

#1 @SergeyBiryukov
19 months ago

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

Hi there, welcome back to WordPress Trac!

Thanks for the report, we're already tracking this issue in #14773.

Note: See TracTickets for help on using tickets.