Automattic\WooCommerce\StoreApi\Utilities
UnexpectedErrorResponse::can_expose_details
Whether the current request may receive the failure message and class.
Метод класса: UnexpectedErrorResponse{}
Хуки из метода
Возвращает
bool.
Использование
$result = UnexpectedErrorResponse::can_expose_details(): bool;
Код UnexpectedErrorResponse::can_expose_details() UnexpectedErrorResponse::can expose details WC 11.3.0
private static function can_expose_details(): bool {
/**
* Filters whether unexpected Store API failures include the error message and exception class in the response.
*
* Details are only ever sent to users who can manage WooCommerce; this filter cannot bypass that check. It defaults to WP_DEBUG so store staff can debug a production store without enabling debug mode site-wide.
*
* @since 11.3.0
*
* @param bool $expose_error_details Whether to include the error message and exception class. Defaults to WP_DEBUG.
*
* @return bool
*/
$expose_error_details = (bool) apply_filters( 'woocommerce_store_api_expose_error_details', Constants::is_true( 'WP_DEBUG' ) );
return $expose_error_details && current_user_can( 'manage_woocommerce' );
}