Automattic\WooCommerce\Internal\Admin\ProductReviews
Reviews::get_capability
Gets the required capability to access the reviews page and manage product reviews.
Method of the class: Reviews{}
Hooks from the method
Returns
String.
Usage
$result = Reviews::get_capability( $context ): string;
- $context(string)
- The context for which the capability is needed (e.g.
viewormoderate).
Default:'view'
Reviews::get_capability() Reviews::get capability code WC 10.6.2
public static function get_capability( string $context = 'view' ): string {
/**
* Filters whether the current user can manage product reviews.
*
* This is aligned to {@see \wc_rest_check_product_reviews_permissions()}
*
* @since 6.7.0
*
* @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) apply_filters( 'woocommerce_product_reviews_page_capability', 'view' === $context ? 'moderate_comments' : 'edit_products', $context );
}