[wp-trac] [WordPress Trac] #45166: Prevent deleting default term for any kind of taxonomy

WordPress Trac noreply at wordpress.org
Wed Oct 24 16:03:19 UTC 2018


#45166: Prevent deleting default term for any kind of taxonomy
-------------------------+-----------------------------
 Reporter:  ediamin      |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Taxonomy     |    Version:  trunk
 Severity:  normal       |   Keywords:  has-patch
  Focuses:               |
-------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45166>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list