I created a list of terms under 'category' when activate plugin. When deactive the plugin, I want to delete them. My function doesn't work, how to make this working?
function ppcontent_deactivate() {
$terms = get_terms( 'category' );
foreach( $terms as $term ){
wp_delete_term($term->term_id,'category');
}
}
register_deactivation_hook( __FILE__, 'ppcontent_deactivate' );