تابع wc_update_200_images بروزرسانی تصاویر ووکامرس به نسخه 2

تابع ووکامرسی wc_update_200_images – بروزرسانی تصاویر ووکامرس به نسخه 2
Syntax – سینتکس
wc_update_200_images();
Usage – نحوه استفاده
if ( !function_exists( 'wc_update_200_images' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-update-functions.php';
}
// NOTICE! Understand what this does before running.
$result = wc_update_200_images();
Defined – محل تعریف
/includes/wc-update-functions.php
function wc_update_200_images() {
// Grab the pre 2.0 Image options and use to populate the new image options settings,
// cleaning up afterwards like nice people do
foreach ( array( 'catalog', 'single', 'thumbnail' ) as $value ) {
$old_settings = array_filter( array(
'width' => get_option( 'woocommerce_' . $value . '_image_width' ),
'height' => get_option( 'woocommerce_' . $value . '_image_height' ),
'crop' => get_option( 'woocommerce_' . $value . '_image_crop' ),
) );
if ( ! empty( $old_settings ) && update_option( 'shop_' . $value . '_image_size', $old_settings ) ) {
delete_option( 'woocommerce_' . $value . '_image_width' );
delete_option( 'woocommerce_' . $value . '_image_height' );
delete_option( 'woocommerce_' . $value . '_image_crop' );
}
}
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر