تابع ووکامرسی wc_attribute_taxonomy_id_by_name گرفتن شناسه ویژگی محصول با نام

تابع ووکامرسی wc_attribute_taxonomy_id_by_name – گرفتن شناسه ویژگی محصول بر اساس نام
Syntax – سینتکس
(int) wc_attribute_taxonomy_id_by_name( (string) $name );
Parameters – پارامتر ها (1)
- 1- $name (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_attribute_taxonomy_id_by_name' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-attribute-functions.php';
}
// Attribute name.
$name = '';
// NOTICE! Understand what this does before running.
$result = wc_attribute_taxonomy_id_by_name($name);
Defined – محل تعریف
/includes/wc-attribute-functions.php
function wc_attribute_taxonomy_id_by_name( $name ) {
$name = str_replace( 'pa_', '', wc_sanitize_taxonomy_name( $name ) );
$taxonomies = wp_list_pluck( wc_get_attribute_taxonomies(), 'attribute_id', 'attribute_name' );
return isset( $taxonomies[ $name ] ) ? (int) $taxonomies[ $name ] : 0;
}
versions – نسخه ها
از نسخه : 2.6.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر