Opened 11 years ago
Closed 11 years ago
#24948 closed enhancement (invalid)
wp_delete_term() Shouldn't delete other default terms
Reported by: | ecabuk | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.1 |
Component: | Taxonomy | Keywords: | has-patch needs-unit-tests |
Focuses: | Cc: |
Description
When we create a custom taxonomy with default term, it can be deletable by wp_delete_term() because it controls only category`s default term to prevent delete. I think wp_delete_term() should control all taxonomy default terms, or at least there should be a pre_delete_taxonomy hook to stop the deletion.
Attachments (1)
Change History (5)
#3
follow-up:
↓ 4
@
11 years ago
- Keywords commit needs-unit-tests added
I didn't know that we supported default terms for other taxonomies.
Unit test?
#4
in reply to:
↑ 3
@
11 years ago
- Keywords commit removed
- Milestone 3.7 deleted
- Resolution set to invalid
- Status changed from new to closed
Replying to nacin:
I didn't know that we supported default terms for other taxonomies.
I don't think we truly do - only categories and link categories get the special treatment in wp_insert_post|link()
and other places. The list table logic just doesn't show the delete link - nothing else actually prevents it from being deleted, and nothing sets default terms, either. If you're using default terms for a custom taxonomy right now, you need custom code to make it actually valuable.
Seems like either we need to say "yes, default terms for taxonomies are supported" and go whole hog and abstract out the special (link_)category treatment, or else the list table needs to not mislead. Either way, new ticket.
Also, related: #21150
Related: #21150.
Indeed, unlike
WP_Terms_List_Table::column_name()
, which checks'default_' . $taxonomy
option (tags/3.6/wp-admin/includes/class-wp-terms-list-table.php#L246),wp_delete_term()
only checks'default_category'
([15690]).The patch would make it consistent. Please use tabs rather than spaces for indentation though (per WordPress Coding Standards).