prefix . 'wbc_logs'; $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); // Delete user meta (BC customer IDs) $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('_wbc_bc_customer_id', '_wbc_bc_customer_number')" ); // Delete post meta (BC item info, order sync info) $wpdb->query( "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '_wbc_%'" ); // Delete order meta for HPOS (if using custom order tables) if ( class_exists( 'Automattic\WooCommerce\Utilities\OrderUtil' ) ) { if ( Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() ) { $orders_table = $wpdb->prefix . 'wc_orders_meta'; if ( $wpdb->get_var( "SHOW TABLES LIKE '$orders_table'" ) === $orders_table ) { $wpdb->query( "DELETE FROM $orders_table WHERE meta_key LIKE '_wbc_%'" ); } } } // Clear any cached data wp_cache_flush();