WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#17939 closed defect (bug) (fixed)

Adding an existing category via the category meta box on the post edit screen fails

Reported by: mdawaffe Owned by: westi
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.2
Component: General Keywords: has-patch
Focuses: Cc:

Description

To reproduce:

  1. Create a post category called "test".
  2. Go to post-new.php
  3. In the category meta box, click "+ Add New Category"
  4. Type "test" into the textbox and click "Add New Category"
  5. Watch "Uncategorized" get added to the list. Look at the AJAX response and see that checkbox's category ID is "Array".

term_exists() can return an array or an ID. Attached checks for arrayness.

Caused by [12798]

Attachments (2)

17939.diff (1.3 KB) - added by mdawaffe 9 years ago.
17939.2.diff (1.4 KB) - added by mdawaffe 9 years ago.
Combine original patch with #17938

Download all attachments as: .zip

Change History (7)

@mdawaffe
9 years ago

#1 @mdawaffe
9 years ago

  • Keywords has-patch added
  • Version set to 3.2

@mdawaffe
9 years ago

Combine original patch with #17938

#2 @westi
9 years ago

  • Owner set to westi
  • Status changed from new to accepted

#3 @ryan
9 years ago

  • Milestone changed from Awaiting Review to 3.4

#4 @nacin
9 years ago

.2.diff looks good.

#5 @ryan
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In [19792]:

Check the return of wp_insert_term() for WP_Error or array. Prevents fatal erros and failure to add categories when adding terms via ajax. Props mdawaffe. fixes #17938 #17939

Note: See TracTickets for help on using tickets.