Opened 6 years ago
Last modified 6 years ago
#45166 new enhancement
Prevent deleting default term for any kind of taxonomy
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
Right now wp_delete_term
doesn't have any check point to prevent deleting default term for a taxonomy except category
. For example, WooCommerce introduced default_product_cat
from v3.3.0. Though, it is not possible to delete this default product category from admin panel, but one can delete this term programmatically or with REST API. There is no hook to prevent this. We have to manually check every time before deleting a term.
So, I propose a change in wp_delete_term
function to prevent deleting default term for any kind of taxonomy if we have an option default_{$taxonomy}
set in options table.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Proposed changes in wp_delete_term function