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{}

Хуки из метода

Возвращает

Строку.

Использование

$result = Reviews::get_capability( $context ) : string;
$context(строка)
The context for which the capability is needed (e.g. view or moderate).
По умолчанию: 'view'

Код Reviews::get_capability() WC 8.7.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 );
}