Make WordPress Core

Opened 15 years ago

Closed 15 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
Priority: normal Milestone: 3.4
Component: General Version: 3.2
Severity: normal Keywords: has-patch
Cc: Focuses:

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 15 years ago.
17939.2.diff​ (1.4 KB ) - added by mdawaffe 15 years ago.
Combine original patch with #17938

Download all attachments as: .zip

Change History (7)

#1 @mdawaffe
15 years ago

  • Keywords has-patch added
  • Version → 3.2

@mdawaffe
15 years ago

Combine original patch with #17938

#2 @westi
15 years ago

  • Owner set to westi
  • Status new → accepted

#3 @ryan
15 years ago

  • Milestone Awaiting Review → 3.4

#4 @nacin
15 years ago

.2.diff looks good.

#5 @ryan
15 years ago

  • Resolution → fixed
  • Status accepted → 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.