wc_taxonomy_metadata_migrate_data( string $wp_db_version, string $wp_current_db_version )
Migrate data from WC term meta to WP term meta.
Description Description
When the database is updated to support term meta, migrate WC term meta data across. We do this when the new version is >= 34370, and the old version is < 34370 (34370 is when term meta table was added).
Parameters Parameters
- $wp_db_version
-
(Required) The new $wp_db_version.
- $wp_current_db_version
-
(Required) The old (current) $wp_db_version.
Source Source
File: includes/wc-term-functions.php
function wc_taxonomy_metadata_migrate_data( $wp_db_version, $wp_current_db_version ) { if ( $wp_db_version >= 34370 && $wp_current_db_version < 34370 ) { global $wpdb; if ( $wpdb->query( "INSERT INTO {$wpdb->termmeta} ( term_id, meta_key, meta_value ) SELECT woocommerce_term_id, meta_key, meta_value FROM {$wpdb->prefix}woocommerce_termmeta;" ) ) { $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_termmeta" ); } } }