woocommerce_product_reviews_page_capability
Filters whether the current user can manage product reviews.
This is aligned to \wc_rest_check_product_reviews_permissions()
Usage
add_filter( 'woocommerce_product_reviews_page_capability', 'wp_kama_woocommerce_product_reviews_page_capability_filter', 10, 2 ); /** * Function for `woocommerce_product_reviews_page_capability` filter-hook. * * @param string $capability The capability (defaults to `moderate_comments` for viewing and `edit_products` for editing). * @param string $context The context for which the capability is needed. * * @return string */ function wp_kama_woocommerce_product_reviews_page_capability_filter( $capability, $context ){ // filter... return $capability; }
- $capability(string)
- The capability (defaults to moderate_comments for viewing and edit_products for editing).
- $context(string)
- The context for which the capability is needed.
Changelog
Since 6.7.0 | Introduced. |
Where the hook is called
woocommerce_product_reviews_page_capability
woocommerce/src/Internal/Admin/ProductReviews/Reviews.php 70
return (string) apply_filters( 'woocommerce_product_reviews_page_capability', 'view' === $context ? 'moderate_comments' : 'edit_products', $context );