As of now if you create two (2) posts with the same title you get the following:
domain.com/test/
domain.com/test-2/
If you create a third post, you then get another url like:
domain.com/test-3/
I am working on a directory, so the odds of someone having the same name is pretty good; therefore I want to append a custom url string to the end of the duplicated name – not just a 1 digit number.
Is there a way for me to add a custom 4-5 digit string at the end of a duplicate post/page/listing? So that it reads:
domain.com/test/
domain.com/test-#####/ < the random string
thanks!
Filter
wp_unique_post_slug
. Make sure to add the callback with6
as last argument to get the original slug. Then create a new unique slug as you need it, you get a lot of context information.