woocommerce_product_reviews_page_capability filter-hookWC 6.7.0

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

Reviews::get_capability()
woocommerce_product_reviews_page_capability
woocommerce/src/Internal/Admin/ProductReviews/Reviews.php 74
return (string) apply_filters( 'woocommerce_product_reviews_page_capability', $context === 'view' ? 'moderate_comments' : 'edit_products', $context );

Where the hook is used in WooCommerce

Usage not found.