Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#25234 closed defect (bug) (wontfix)

wp_create_term is defined in the wrong file

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Taxonomy Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

wp_create_term() is just a wrapper for a term_exists() check and wp_insert_term(), but it's defined in a file that's only included in the admin area. This means wp_create_term() can't be used on the front end without including wp-admin/includes/taxonomy.php. Not good.

Attachments (2)

25234.diff (1.3 KB) - added by johnbillion 11 years ago.
25234.2.diff (1.6 KB) - added by wonderboymusic 11 years ago.

Download all attachments as: .zip

Change History (8)

@johnbillion
11 years ago

#1 @johnbillion
11 years ago

25234.diff moves wp_create_term() from wp-admin/includes/taxonomy.php to wp-includes/taxonomy.php where it belongs.

#2 @johnbillion
11 years ago

  • Keywords has-patch added

#3 @wonderboymusic
11 years ago

  • Milestone changed from Awaiting Review to 3.9

Refreshed this - let's do it or decide not to.

#4 @nacin
11 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from 3.9 to Awaiting Review

wp_create_term() is kind of crappy. A "create" action should never silently return something existing. This seems like a bad pattern. I'd rather not introduce a generically named function into the main includes namespace. It'll just confuse new developers.

#5 @wonderboymusic
10 years ago

  • Owner set to johnbillion
  • Status changed from new to reviewing

You may want to close this out

#6 @johnbillion
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.