Created
September 25, 2017 18:40
-
-
Save felipeelia/31461c515f9be24a34d7af9f3186f1b9 to your computer and use it in GitHub Desktop.
Delete ALL Terms In A Taxonomy (Use With Caution)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$taxonomy_slug = 'area'; | |
$wpdb->query( "DELETE a, b, c, d | |
FROM {$wpdb->term_taxonomy} a | |
LEFT JOIN {$wpdb->terms} b | |
ON (a.term_id = b.term_id) | |
LEFT JOIN {$wpdb->term_relationships} c | |
ON (a.term_taxonomy_id = c.term_taxonomy_id) | |
LEFT JOIN {$wpdb->termmeta} d | |
ON (a.term_id = d.term_id) | |
WHERE a.taxonomy = {$taxonomy_slug}" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment