WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#2421 closed enhancement (wontfix)

Create advanded option to allow posts to have same slug?

Reported by: Viper007Bond Owned by: markjaquith
Milestone: Priority: lowest
Severity: normal Version: 2.0.1
Component: General Keywords: bg|has-patch
Focuses: Cc:

Description

I think it'd be nice to be able to have an option to allow posts to have the same slug. Now I realize this can create major problems if permalinks are set up like "/year/postname/" or something, so I suggest that if this becomes a realization, that this new option have no GUI to change it in the admin area. We don't need tons of noobs screwing up their blog by playing with this option. This option would be for advanced users only.

And from poking around, I realize that this may be a bit of work (i.e. the database itself makes sure that post slugs are unique), but I think it'd still be worth it.

Any thoughts on this?

And no, no patch yet as I figured it wasn't worth my time if this ticket ends up getting marked as "wontfix". I am willing to create a patch or help or whatever though if the head honchos think this ticket is worthwhile to invest in.

Attachments (1)

post_name_uniqueness_specificity.diff (1.9 KB) - added by markjaquith 9 years ago.
Uniqueness based on current permalink structure

Download all attachments as: .zip

Change History (8)

comment:1 @Viper007Bond9 years ago

  • Priority changed from low to lowest

Okay, well I take back the database thing. Even though the post_name column is set as an index, I forgot that it's gotta be set as unique to do have unique values.

Also, a sweet plugin was pointed out to me. I've activated it and it works like a charm, so this ticket can be ignored if you like as I'm now happy. :)

comment:2 @markjaquith9 years ago

How about enforcing slug "uniqueness" only to the degree that is needed by the current permalink structure?

That is, if the structure has %year%, only make it unique within the year. If %monthnum%, unique within that month. And if %day%, unique within the day (who posts twice in a day with the same slug?)

Easier said than coded, but it would be an elegant solution.

@markjaquith9 years ago

Uniqueness based on current permalink structure

comment:3 @markjaquith9 years ago

  • Keywords bg|has-patch added
  • Milestone set to 2.1
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Patch looks for the presence of %day%, %monthnum% and %year% in the permalink structure.

If %day% is found, uniqueness is made for that day

elseif %month% is found, uniqueness is made for the month

elseif %year% is found, uniqueness is made for the year

else the post slug will be absolutely unique

comment:4 @Viper007Bond9 years ago

Ooo, great idea and patch! :D

comment:5 @davidhouse9 years ago

If this can be done with a plugin it seems a bit contrived to be core. I'm -1.

comment:6 @matt8 years ago

  • Resolution set to wontfix
  • Status changed from assigned to closed

comment:7 @Nazgul8 years ago

  • Milestone 2.1 deleted
Note: See TracTickets for help on using tickets.