wc_rest_check_product_term_permissions بررسی permission پست ترم محصول

تابع ووکامرسی wc_rest_check_product_term_permissions – بررسی permission پست ترم محصول
Syntax – سینتکس
wc_rest_check_product_term_permissions( (string) $taxonomy, (string) $context = 'read', (int) $object_id = 0 );
Parameters – پارامتر ها (3)
- 1- $taxonomy (string)
- 2- $context (string)
- 3- $object_id (int)
Usage – نحوه استفاده
if ( !function_exists( 'wc_rest_check_product_term_permissions' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-rest-functions.php';
}
// The taxonomy.
$taxonomy = '';
// Request context.
$context = 'read';
// The object id.
$object_id = -1;
// NOTICE! Understand what this does before running.
$result = wc_rest_check_product_term_permissions($taxonomy, $context, $object_id);
Defined – محل تعریف
/includes/wc-rest-functions.php
function wc_rest_check_product_term_permissions( $taxonomy, $context = 'read', $object_id = 0 ) {
$contexts = array(
'read' => 'manage_terms',
'create' => 'edit_terms',
'edit' => 'edit_terms',
'delete' => 'delete_terms',
'batch' => 'edit_terms',
);
$cap = $contexts[ $context ];
$taxonomy_object = get_taxonomy( $taxonomy );
$permission = current_user_can( $taxonomy_object->cap->$cap, $object_id );
return apply_filters( 'woocommerce_rest_check_permissions', $permission, $context, $object_id, $taxonomy );
}
versions – نسخه ها
از نسخه : 2.6.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر