[wp-hackers] 'same category name'-issue

robin niemeyer robin.niemeyer at gmx.net
Fri Apr 10 14:47:08 GMT 2009

Hi all,

I know this issue has been posted frequently in the wp support forum,
the ticket system etc., but it seems there has been some silence around
it since then, although I think it still is a problem to many people
(including me).

What I mean is the issue that every term has to be unique, and while
this makes a lot of sense regarding tags, it has some serious drawbacks
when it comes to categories, since this isn't possible right now:

-Sheet Music
-Learn to Play

(Example taken from http://wordpress.org/support/topic/177232)

The track tickets regarding this issue are tickets #6211 & #5034, both
stating WP 2.9 as a milestone for resolving the problem. But since this
seems to be a database design/abstraction issue it's not unlikely that
it would stay around for a while, if it can't be solved inside the code
base itself.

Be it as it is, I think there is a desperate need of a workaround,
mainly because it should be possible to set up the structure you like
(or need) to categorize your content (I think it's best to discuss this
under a categories perspective rather than a terms perspective, because
as far I can see this is about categories alone, which is why I think
it's an abstraction issue).

The only solution I could imagine is to call the pre_category_name &
pre_category_nicename filter hooks inside wp_insert_category() and the
like before any validation testing takes place, so it's left to the
developer to act accordingly without breaking the rules (e.g., to prefix
the name with some sort of token that could be filtered out in both
backend and frontend view while the data itself rests untouched).

I think there is a reason that both hooks don't get called during
category insertion (pre_category_name doesn't seem to be called
anywhere), but what reason is it? And if there's no reason for it, is
there a chance that this gets implemented in one of the upcoming
revisions? Or is there some alternative to accomplish the task of
getting equally named categories to work?

- Robin

More information about the wp-hackers mailing list