Automattic\WooCommerce\Internal\Admin\ProductReviews

Reviews::get_capability()public staticWC 1.0

Gets the required capability to access the reviews page and manage product reviews.

Метод класса: Reviews{}

Return

String.

Usage

$result = Reviews::get_capability( $context ) : string;
$context(string)
The context for which the capability is needed (e.g. view or moderate).
Default: 'view'

Code of Reviews::get_capability() WC 7.1.0

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', $context === 'view' ? 'moderate_comments' : 'edit_products', $context );
}