Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#25234 closed defect (bug) (wontfix)

wp_create_term is defined in the wrong file

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


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 8 years ago.
25234.2.diff (1.6 KB) - added by wonderboymusic 8 years ago.

Download all attachments as: .zip

Change History (8)

8 years ago

#1 @johnbillion
8 years ago

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

#2 @johnbillion
8 years ago

  • Keywords has-patch added

#3 @wonderboymusic
8 years ago

  • Milestone changed from Awaiting Review to 3.9

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

#4 @nacin
8 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
7 years ago

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

You may want to close this out

#6 @johnbillion
7 years ago

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