Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bulk delete all terms of given taxonomy [Wordpress]
function delete_all_terms(){
$taxonomy_name = 'city';
$terms = get_terms( array(
'taxonomy' => $taxonomy_name,
'hide_empty' => false
) );
foreach ( $terms as $term ) {
wp_delete_term($term->term_id, $taxonomy_name);
}
}
add_action( 'wp_head', 'delete_all_terms' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.