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

robin niemeyer robin.niemeyer at gmx.net
Fri Apr 10 16:10:23 GMT 2009

Their are three things that are troubling me regarding this solution
(although it works):

- Say you set up a blog not for yourself but for a customer. Even if you
like to, you can't say to him/her: 'In order get things working, mispell
your category so that it is unique, then update it.' This would leave
him/her drawing conclusions with regard both to your skills and the
system you choose you really don't want to let him/her draw.

- As Dylan wrotes would be nice if an added category was validated by
the same rules as an updated one, which is true, but it is also possible
that in a future release updated categories get validated the same way
inserted ones do - which would be somewhat consequent considering the
uniqueness of terms rule.

- It's more a hack than a solution, and it depends on the user's
interaction, not on the underlying logic.

So, all in all this one's not really an option to me (same goes for
using tags instead of categories), not only because of this customer
thing, but mainly because I think this requires a more general approach.

> in the end
> you'll need unique slugs anyway

My fault, I talked about the slug hook only for the sake of
completeness; truth is that the unique slug problem is handled perfectly
well by WordPress itself by prefixing a non-unique slug with its
parent's slug. But WordPress (I'm using 2.7.) still validates against
the category name :-(

- Robin

Michael Toppa schrieb:
> What's wrong with the solution that's presented at the end of the
> support thread you linked to? (having 2 or more categories with the same
> name as long as their slugs are different). No matter what kind of
> abstraction you apply to the parent-child relationships, in the end
> you'll need unique slugs anyway, to maintain flexible permalink options.
> Mike T
>> Date: Fri, 10 Apr 2009 16:47:08 +0200
>> From: robin niemeyer <robin.niemeyer at gmx.net>
>> Subject: [wp-hackers] 'same category name'-issue
>> To: wp-hackers at lists.automattic.com
>> Message-ID: <49DF5BEC.1050007 at gmx.net>
>> Content-Type: text/plain; charset=ISO-8859-15
>> 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
>> ---Piano
>> ---Violin
>> -Learn to Play
>> ---Piano
>> ---Violin
>> (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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list