[wp-trac] Re: [WordPress Trac] #9335: Child categories error out as
duplicates even if slugs and parent categories are different
WordPress Trac
wp-trac at lists.automattic.com
Sun Mar 15 02:17:04 GMT 2009
#9335: Child categories error out as duplicates even if slugs and parent
categories are different
----------------------------+-----------------------------------------------
Reporter: mofoq | Owner: anonymous
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.8
Component: Administration | Version: 2.7.1
Severity: normal | Keywords:
----------------------------+-----------------------------------------------
Comment(by zeronex):
Replying to [comment:2 mofoq]:
> Replying to [comment:1 zeronex]:
>
> I tried using an unique slug but it didn't work at least not when
creating a new one.
> I haven't tried "editing" an existing one though.
>
>
> instead, I ended up making a minor "adjustment" in admin-ajax.php, line
312
>
> {{{
> if ( category_exists( trim( $_POST['cat_name'] ) ) ) {
> $x = new WP_Ajax_Response( array(
> 'what' => 'cat',
> 'id' => new WP_Error( 'cat_exists', __('The
category you are trying to create already exists.'), array( 'form-field'
=> 'cat_name' ) ),
> ) );
> $x->send();
> }
> }}}
>
> to
>
> {{{
> if ( !empty(get_category_by_slug(trim(
$_POST['category_nicename']))->cat_name) ) {
> $x = new WP_Ajax_Response( array(
> 'what' => 'cat',
> 'id' => new WP_Error( 'cat_exists', __('The
category you are trying to create has a slug that already exists. Please
use an unique slug.' ), array( 'form-field' => 'cat_name' ) ),
> ) );
> $x->send();
> }
>
> }}}
>
> it basically uses the slug instead and checks to see if it can get a
category from it (it might be better to change it to check if a cat_id is
non-empty instead of cat_name)[[BR]]
I think categories with similar name should only be allowed if the parents
are different and have different slugs. Well even if slugs are same URL
will be different.[[BR]]
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9335#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list