Skip to content

Commit 9351aef

Browse files
authored
Merge pull request #3 from BeAPI/feature/error_message
Allow a better wp_error message with domain and URL
2 parents 10bf99c + c3d1c5a commit 9351aef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wp-http-blocklist.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ function pre_http_request( $flag, $parsed_args, $url ) {
5656

5757
foreach ( $blocklist as $blocklist_domain ) {
5858
if ( $request_host === $blocklist_domain ) {
59-
$response = new \WP_Error( 'http_request_blocked', __( 'This URL is blocked from a deny list.', 'wp-http-blocklist' ) );
59+
// translators: First is the host blocked, second is the full url called
60+
$response = new \WP_Error( 'http_request_blocked', sprintf( __( 'Host %1$s is blocked from a deny list.', 'wp-http-blocklist' ), $request_host ) );
6061
/** This action is documented in wp-includes/class-http.php */
6162
do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url );
6263

0 commit comments

Comments
 (0)