You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"DELETE tm from $wpdb->termmeta AS tm INNER JOIN $wpdb->term_taxonomy AS tt ON tm.term_id = tt.term_id WHERE tt.taxonomy = %s;",
98
+
$taxonomy
99
+
)
94
100
);
95
101
96
-
// Delete orphan relationships.
97
-
$wpdb->query( "DELETE tr FROM $wpdb->term_relationships AS tr LEFT JOIN $wpdb->posts AS posts ON posts.ID = tr.object_id WHERE posts.ID IS NULL;" );
98
-
99
-
// Delete orphan terms.
100
-
$wpdb->query( "DELETE t FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.term_id IS NULL;" );
102
+
// Delete term relationship.
103
+
$wpdb->query(
104
+
$wpdb->prepare(
105
+
"DELETE tr from $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = %s;",
106
+
$taxonomy
107
+
)
108
+
);
101
109
102
-
// Delete orphan term meta.
103
-
$wpdb->query( "DELETE tm FROM $wpdb->termmeta AS tm LEFT JOIN $wpdb->term_taxonomy AS tt ON tm.term_id = tt.term_id WHERE tt.term_id IS NULL;" );
110
+
// Delete terms.
111
+
$wpdb->query(
112
+
$wpdb->prepare(
113
+
"DELETE terms from $wpdb->terms AS terms INNER JOIN $wpdb->term_taxonomy AS tt ON terms.term_id = tt.term_id WHERE tt.taxonomy = %s;",
0 commit comments