Skip to content

Instantly share code, notes, and snippets.

View Marigno's full-sized avatar
💻
Building

Diego Marigno Marigno

💻
Building
View GitHub Profile
@trey8611
trey8611 / delete-empty-taxonomy-terms-on-post-delete.md
Created November 24, 2021 15:06
[Delete empty taxonomy terms on post delete] #wpallimport
// Delete empty taxonomies on post delete
function wpai_remove_taxonomies_on_delete( $post_id, $import ) {
    $taxonomy = 'product_cat'; // change this to the taxonomy name
    $terms = wp_get_object_terms( $post_id, $taxonomy );

    if ( ! empty( $terms ) ) {
        $all_terms = array();
        foreach ( $terms as $term ) {
 if ( $term->count < 2 ) {
@trey8611
trey8611 / import-optimizations.md
Last active July 1, 2024 03:41
WP All Import - Optimize your import speed.