woocommerce_store_api_expose_error_details
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.
Использование
add_filter( 'woocommerce_store_api_expose_error_details', 'wp_kama_woocommerce_store_api_expose_error_details_filter' );
/**
* Function for `woocommerce_store_api_expose_error_details` filter-hook.
*
* @param bool $expose_error_details Whether to include the error message and exception class.
*
* @return bool
*/
function wp_kama_woocommerce_store_api_expose_error_details_filter( $expose_error_details ){
// filter...
return $expose_error_details;
}
- $expose_error_details(true|false)
- Whether to include the error message and exception class.
По умолчанию: WP_DEBUG
Список изменений
| С версии 11.3.0 | Введена. |
Где вызывается хук
woocommerce_store_api_expose_error_details
woocommerce/src/StoreApi/Utilities/UnexpectedErrorResponse.php 95
$expose_error_details = (bool) apply_filters( 'woocommerce_store_api_expose_error_details', Constants::is_true( 'WP_DEBUG' ) );