woocommerce_product_reviews_page_capability хук-фильтрWC 6.7.0

Filters whether the current user can manage product reviews.

This is aligned to \wc_rest_check_product_reviews_permissions()

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

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(строка)
The capability (defaults to moderate_comments for viewing and edit_products for editing).
$context(строка)
The context for which the capability is needed.

Список изменений

С версии 6.7.0 Введена.

Где вызывается хук

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

Где используется хук в WooCommerce

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