تابع wc_update_200_permalinks بروزرسانی پیوند یکتا ووکامرس به نسخه 2

تابع ووکامرسی wc_update_200_permalinks – بروزرسانی پیوند یکتا ووکامرس به نسخه 2
Syntax – سینتکس
wc_update_200_permalinks();
Usage – نحوه استفاده
if ( !function_exists( 'wc_update_200_permalinks' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-update-functions.php';
}
// NOTICE! Understand what this does before running.
$result = wc_update_200_permalinks();
Defined – محل تعریف
/includes/wc-update-functions.php
function wc_update_200_permalinks() {
// Setup default permalinks if shop page is defined
$permalinks = get_option( 'woocommerce_permalinks' );
$shop_page_id = wc_get_page_id( 'shop' );
if ( empty( $permalinks ) && $shop_page_id > 0 ) {
$base_slug = $shop_page_id > 0 && get_post( $shop_page_id ) ? get_page_uri( $shop_page_id ) : 'shop';
$category_base = get_option( 'woocommerce_prepend_shop_page_to_urls' ) == "yes" ? trailingslashit( $base_slug ) : '';
$category_slug = get_option( 'woocommerce_product_category_slug' ) ? get_option( 'woocommerce_product_category_slug' ) : _x( 'product-category', 'slug', woocommerce );
$tag_slug = get_option( 'woocommerce_product_tag_slug' ) ? get_option( 'woocommerce_product_tag_slug' ) : _x( 'product-tag', 'slug', woocommerce );
if ( 'yes' == get_option( 'woocommerce_prepend_shop_page_to_products' ) ) {
$product_base = trailingslashit( $base_slug );
} else {
if ( ( $product_slug = get_option( 'woocommerce_product_slug' ) ) !== false && ! empty( $product_slug ) ) {
$product_base = trailingslashit( $product_slug );
} else {
$product_base = trailingslashit( _x( 'product', 'slug', woocommerce ) );
}
}
if ( get_option( 'woocommerce_prepend_category_to_products' ) == 'yes' )
$product_base .= trailingslashit( '%product_cat%' );
$permalinks = array(
'product_base' => untrailingslashit( $product_base ),
'category_base' => untrailingslashit( $category_base . $category_slug ),
'attribute_base' => untrailingslashit( $category_base ),
'tag_base' => untrailingslashit( $category_base . $tag_slug ),
);
update_option( 'woocommerce_permalinks', $permalinks );
}
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر