Make WordPress Core

Opened 8 months ago

Last modified 5 weeks ago

#25234 new defect (bug)

wp_create_term is defined in the wrong file

Reported by: johnbillion Owned by:
Milestone: Awaiting Review 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 months ago.
25234.2.diff (1.6 KB) - added by wonderboymusic 2 months ago.

Download all attachments as: .zip

Change History (6)

johnbillion8 months ago

comment:1 johnbillion8 months ago

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

comment:2 johnbillion8 months ago

  • Keywords has-patch added

comment:3 wonderboymusic2 months ago

  • Milestone changed from Awaiting Review to 3.9

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

wonderboymusic2 months ago

comment:4 nacin5 weeks 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.

Note: See TracTickets for help on using tickets.