[wp-trac] [WordPress Trac] #23069: For plugins that create custom taxonomies, wp_delete_term does not work during plugin uninstall.

WordPress Trac noreply at wordpress.org
Fri Dec 28 15:10:51 UTC 2012


#23069: For plugins that create custom taxonomies, wp_delete_term does not work
during plugin uninstall.
-----------------------------+--------------------------
 Reporter:  sscovil          |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Taxonomy
  Version:  3.5              |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 I ran into this problem while writing a plugin uninstall class to clean up
 any options, custom post types, taxonomies & terms related to the plugin.

 The problem is, if a plugin creates a custom taxonomy and the plugin user
 creates terms for that taxonomy, the plugin cannot delete those terms
 during uninstall.

 How to reproduce:

 1. Create a plugin that creates a custom taxonomy.
 2. Create some terms for that taxonomy.
 3. In uninstall.php, try using wp_delete_term to remove those terms.

 Because the plugin is already deactivated by the time uninstall.php fires,
 $wp_taxonomies no longer contains the custom taxonomy that the plugin
 created. Since wp_delete_term requires a valid taxonomy as its second
 parameter, it does not work.

 The issue is also being discussed here: http://bit.ly/RUDYOv

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23069>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list