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 | Owned by: | 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)
Change History (8)
#3
@
11 years ago
- Milestone changed from Awaiting Review to 3.9
Refreshed this - let's do it or decide not to.
#4
@
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.
Note: See
TracTickets for help on using
tickets.
25234.diff moves
wp_create_term()
fromwp-admin/includes/taxonomy.php
towp-includes/taxonomy.php
where it belongs.