Uninstall.php: remove custom taxonomy and term
-
Hi,
I have this in my uninstall.php in order to delete my custom taxonomy called ‘event_cat’ and all terms:
// If uninstall is not called from WordPress, exit if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit(); // Delete terms $terms = get_terms( 'event_cat', array( 'fields' => 'ids', 'hide_empty' => false ) ); foreach ( $terms as $value ) { wp_delete_term( $value, 'event_cat' ); } global $wpdb; // Delete taxonomy $table = $wpdb->prefix . "event_cat"; $wpdb->query( "DROP TABLE IF EXISTS $table" );
But after de-installing plugin custom taxonomy and terms are still listed in database.
Am I missing something?
Guido
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Uninstall.php: remove custom taxonomy and term’ is closed to new replies.