wc_taxonomy_metadata_update_content_for_split_terms داده ترم محفوظ شود

تابع ووکامرسی wc_taxonomy_metadata_update_content_for_split_terms – پس از تقسیم ترم از اطلاعات آن مراقبت شود
Syntax – سینتکس
wc_taxonomy_metadata_update_content_for_split_terms( (int) $old_term_id, (int) $new_term_id, (string) $term_taxonomy_id, (string) $taxonomy );
Parameters – پارامتر ها (4)
- 1- $old_term_id (int)
- 2- $new_term_id (int)
- 3- $term_taxonomy_id (string)
- 4- $taxonomy (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_taxonomy_metadata_update_content_for_split_terms' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-term-functions.php';
}
// The old term id.
$old_term_id = -1;
// The new term id.
$new_term_id = -1;
// The term taxonomy id.
$term_taxonomy_id = '';
// The taxonomy.
$taxonomy = '';
// NOTICE! Understand what this does before running.
$result = wc_taxonomy_metadata_update_content_for_split_terms($old_term_id, $new_term_id, $term_taxonomy_id, $taxonomy);
Defined – محل تعریف
/includes/wc-term-functions.php
function wc_taxonomy_metadata_update_content_for_split_terms( $old_term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
global $wpdb;
if ( get_option( 'db_version' ) < 34370 ) {
if ( 'product_cat' === $taxonomy || taxonomy_is_product_attribute( $taxonomy ) ) {
$old_meta_data = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM {$wpdb->prefix}woocommerce_termmeta WHERE woocommerce_term_id = %d;", $old_term_id ) );
// Copy across to split term
if ( $old_meta_data ) {
foreach ( $old_meta_data as $meta_data ) {
$wpdb->insert(
"{$wpdb->prefix}woocommerce_termmeta",
array(
'woocommerce_term_id' => $new_term_id,
'meta_key' => $meta_data->meta_key,
'meta_value' => $meta_data->meta_value,
)
);
}
}
}
}
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر