[wp-hackers] slugs and the "-2" post fix

Haluk Karamete halukkaramete at gmail.com
Wed Dec 5 04:51:13 UTC 2012

I have two questions that deal with terms' being end up with  "-2"
postfix in their slugs. I run into those when I programmatically
create the posts/tags/terms.

My first question has to do with terms' being case sensitive...
that's one of the two ways resulting a term being end up with a "-2"
in its slug.


If I create a term like "tree" in the "post_tag" taxonomy, it gets a
slug of "tree".
if I create another term say "Tree" in the same taxonomy, then the new
term gets the slug of "tree-2". Even though, I mean the same thing.
I'm curious to know what's the wisdom behind this default behavior and
if there is any way to force/tell WP to ignore the case so both terms
be it TREE or tree get the same slug.

My second question is on the other situation where two identical
terms' being end up with the "-2" situation. And this only happens
when the terms belong to different taxonomies.


term "apple" created in the "computers" taxonomy gets the slug of "apple".
and the term "apple" created in the "fruits" taxonomy gets the slug of
"apple-2". this puzzles the heck out of me. I can understand the first
situation that I mentioned above to some degree, but this one, totally
silences me.

why can't both terms have "apple" as their slug?

WP would still work with both URLs anyway.

the current behavior results me to end up with
domain.com/fruits/apple-2 which does not look professional at all.

Any insight is greatly appreciated. Thank you

More information about the wp-hackers mailing list