wc_rest_check_product_term_permissions()
Check permissions of product terms on REST API.
Hooks from the function
Return
true|false
.
Usage
wc_rest_check_product_term_permissions( $taxonomy, $context, $object_id );
- $taxonomy(string) (required)
- Taxonomy.
- $context(string)
- Request context.
Default: 'read' - $object_id(int)
- Post ID.
Changelog
Since 2.6.0 | Introduced. |
wc_rest_check_product_term_permissions() wc rest check product term permissions code WC 9.4.2
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 ); }