Skip to content

Commit

Permalink
No need to delete termmeta if using the new tables
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Nov 6, 2015
1 parent d64bcd7 commit 19da7cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function delete_term( $term_id ) {

$term_id = absint( $term_id );

if ( $term_id ) {
if ( $term_id && get_option( 'db_version' ) < 34370 ) {
$wpdb->delete( $wpdb->woocommerce_termmeta, array( 'woocommerce_term_id' => $term_id ), array( '%d' ) );
}
}
Expand Down
4 changes: 3 additions & 1 deletion includes/api/class-wc-api-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,9 @@ public function delete_product_category( $id ) {
}

// When a term is deleted, delete its meta.
$wpdb->delete( $wpdb->woocommerce_termmeta, array( 'woocommerce_term_id' => $id ), array( '%d' ) );
if ( get_option( 'db_version' ) < 34370 ) {
$wpdb->delete( $wpdb->woocommerce_termmeta, array( 'woocommerce_term_id' => $id ), array( '%d' ) );
}

do_action( 'woocommerce_api_delete_product_category', $id, $this );

Expand Down

0 comments on commit 19da7cf

Please sign in to comment.