Opened 2 years ago

Closed 16 months 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:

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

Download all attachments as: .zip

Change History (7)

  • Keywords has-patch added
  • Version set to 3.2

Combine original patch with #17938

  • Owner set to westi
  • Status changed from new to accepted
  • Milestone changed from Awaiting Review to 3.4

.2.diff looks good.

  • 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.