woocommerce_rest_customer_allowed_roles хук-фильтрWC 9.5.2

Filter the allowed roles for the REST API.

Danger: Make sure that the roles listed here cannot manage the shop.

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

add_filter( 'woocommerce_rest_customer_allowed_roles', 'wp_kama_woocommerce_rest_customer_allowed_roles_filter' );

/**
 * Function for `woocommerce_rest_customer_allowed_roles` filter-hook.
 * 
 * @param array $roles Array of allowed roles.
 *
 * @return array
 */
function wp_kama_woocommerce_rest_customer_allowed_roles_filter( $roles ){

	// filter...
	return $roles;
}
$roles(массив)
Array of allowed roles.

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

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

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

WC_REST_Customers_V1_Controller::allowed_roles()
woocommerce_rest_customer_allowed_roles
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php 156
return apply_filters( 'woocommerce_rest_customer_allowed_roles', array( 'customer', 'subscriber' ) );

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

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