Delete all usermeta on uninstall with prefix woocommerce_
This commit is contained in:
parent
e4bcc1d285
commit
6714658fbc
|
@ -51,17 +51,15 @@ if ( defined( 'WC_REMOVE_ALL_DATA' ) && true === WC_REMOVE_ALL_DATA ) {
|
|||
// Delete options.
|
||||
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'woocommerce\_%';" );
|
||||
|
||||
// Delete usermeta.
|
||||
$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'woocommerce\_%';" );
|
||||
|
||||
// Delete posts + data.
|
||||
$wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'product', 'product_variation', 'shop_coupon', 'shop_order', 'shop_order_refund' );" );
|
||||
$wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" );
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_order_items" );
|
||||
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_order_itemmeta" );
|
||||
|
||||
// Delete user meta data.
|
||||
foreach ( array( 'woocommerce_keys_per_page', 'woocommerce_webhooks_per_page' ) as $meta_key ) {
|
||||
delete_metadata( 'user', 0, $meta_key, '', true );
|
||||
}
|
||||
|
||||
// Delete terms if > WP 4.2 (term splitting was added in 4.2).
|
||||
if ( version_compare( $wp_version, '4.2', '>=' ) ) {
|
||||
// Delete term taxonomies.
|
||||
|
|
Loading…
Reference in New Issue