[wp-trac] [WordPress Trac] #5305: permalinks broken when article name is numeric

WordPress Trac noreply at wordpress.org
Fri Feb 27 15:49:42 UTC 2015


#5305: permalinks broken when article name is numeric
--------------------------+---------------------------
 Reporter:  thomask       |       Owner:  valendesigns
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.2
Component:  Permalinks    |     Version:  2.3.1
 Severity:  major         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------

Comment (by boonebgorges):

 Getting closer :)

 After some conversation with valendesigns, I'm going to propose that we
 take a two-pronged strategy. See [attachment:5305.12.diff].

 1. During `parse_request()`, if we detect that a URL looks like a date
 query, look for conflicts with posts that have numeric slugs. (This is
 what 11.diff already did.)
 2. Simply doing (1) is a potentially incomplete solution, because it fixes
 the original bug - not being able to access a post '28' located at
 `/2015/02/28/` - at the expense of creating another, lesser bug - not
 being able to access the date archive at `/2015/02/28/`. So we should also
 attempt to prevent the creation of posts with this kind of slug. 12.diff
 attempts a solution that is more modest, in two ways, than what has been
 suggested in previous discussion on this ticket.
     a. It only affects the auto-generated slug in
 `get_sample_permalink()`. If you want to override this by manually
 entering a conflicting slug (or by creating posts programatically), you
 may.
     b. It only enforces uniqueness (using the `-2` etc formula used in
 `wp_unique_post_slug()`) if it's detected that the suggested post would
 actually create a date conflict. We look at the current permalink
 structure, and verify that the autogenerated `post_name` would be a valid
 value for year/monthnum/day, as appropriate. So the suffixing will only
 happen in very rare cases, instead of every time the `post_name` is
 numeric.

 Feedback welcome. I'd especially like to know what people think about the
 `get_sample_permalink()` strategy - is it too lax? Should we be enforcing
 this in `wp_unique_post_slug()`?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/5305#comment:73>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list