[wp-trac] [WordPress Trac] #16567: Can't create single-character categories

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 14 09:05:58 UTC 2012


#16567: Can't create single-character categories
----------------------------+--------------------
 Reporter:  jeffreymcmanus  |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  3.5
Component:  Administration  |     Version:  3.0.5
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+--------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch needs-testing close => has-patch
 * component:  General => Administration
 * milestone:  Awaiting Review => 3.5


Comment:

 The code is still there, and I can reproduce the issue in both trunk and
 3.4.2.

 1. Go to Edit Post screen.
 2. Create "C#" category.
 3. Try to create "C" category. It won't be created.

 The only difference from 3.0.5 is that "Uncategorized" item no longer gets
 added to the list in step 3. That was fixed in [19792] (for #17939).

 A check for empty name was added in [6303]. `is_term()` was added in
 [12798] as a check for an existing term, and renamed to `term_exists()` in
 [15220].

 Looking at the code, it doesn't make much sense to check if a category
 with the same slug exists here. This is better handled further down the
 stack in `wp_insert_term()`, as noted by garyc40 in comment:6.

 A check for empty name: [[BR]]
 http://core.trac.wordpress.org/browser/tags/3.4.2/wp-
 includes/taxonomy.php#L2031 [[BR]]
 A check for an existing term: [[BR]]
 http://core.trac.wordpress.org/browser/tags/3.4.2/wp-
 includes/taxonomy.php#L2063 [[BR]]
 `trim()` is a part of in `sanitize_text_field()`: [[BR]]
 http://core.trac.wordpress.org/browser/tags/3.4.2/wp-
 includes/formatting.php#L3164

 [attachment:16567.2.diff] removes unnecessary checks from `ajax-
 actions.php`.
 `is_array()` is removed as well, since `wp_insert_term()` only returns an
 array or a `WP_Error` object.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16567#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list