[wp-hackers] 'same category name'-issue
Michael Toppa
public at toppa.com
Fri Apr 10 15:24:34 GMT 2009
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
>
More information about the wp-hackers
mailing list