wc_check_if_attribute_name_is_reserved بررسی اینکه آیا نام ویژگی رزرو شده است ؟

تابع ووکامرسی wc_check_if_attribute_name_is_reserved – بررسی اینکه آیا نام ویژگی رزرو شده است ؟
Syntax – سینتکس
wc_check_if_attribute_name_is_reserved( (string) $attribute_name );
Parameters – پارامتر ها (1)
- 1- $attribute_name (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_check_if_attribute_name_is_reserved' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-attribute-functions.php';
}
// The attribute name.
$attribute_name = '';
// NOTICE! Understand what this does before running.
$result = wc_check_if_attribute_name_is_reserved($attribute_name);
Defined – محل تعریف
/includes/wc-attribute-functions.php
function wc_check_if_attribute_name_is_reserved( $attribute_name ) {
// Forbidden attribute names
$reserved_terms = array(
'attachment',
'attachment_id',
'author',
'author_name',
'calendar',
'cat',
'category',
'category__and',
'category__in',
'category__not_in',
'category_name',
'comments_per_page',
'comments_popup',
'cpage',
'day',
'debug',
error,
'exact',
'feed',
'hour',
'link_category',
'm',
'minute',
'monthnum',
'more',
'name',
'nav_menu',
'nopaging',
'offset',
'order',
'orderby',
'p',
'page',
'page_id',
'paged',
'pagename',
'pb',
'perm',
'post',
'post__in',
'post__not_in',
'post_format',
'post_mime_type',
'post_status',
'post_tag',
'post_type',
'posts',
'posts_per_archive_page',
'posts_per_page',
'preview',
'robots',
's',
'search',
'second',
'sentence',
'showposts',
'static',
'subpost',
'subpost_id',
'tag',
'tag__and',
'tag__in',
'tag__not_in',
'tag_id',
'tag_slug__and',
'tag_slug__in',
'taxonomy',
'tb',
'term',
'type',
'w',
'withcomments',
'withoutcomments',
'year',
);
return in_array( $attribute_name, $reserved_terms );
}
versions – نسخه ها
از نسخه : 2.4.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر