diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index 9af88a6ea2..da53ee3d25 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -1189,11 +1189,12 @@ if ( ! function_exists( 'wp_redirect' ) ) : * * @global bool $is_IIS * - * @param string $location The path or URL to redirect to. - * @param int $status Optional. HTTP response status code to use. Default '302' (Moved Temporarily). + * @param string $location The path or URL to redirect to. + * @param int $status Optional. HTTP response status code to use. Default '302' (Moved Temporarily). + * @param string $x_redirect_by Optional. The application doing the redirect. Default 'WordPress'. * @return bool False if the redirect was cancelled, true otherwise. */ - function wp_redirect( $location, $status = 302 ) { + function wp_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) { global $is_IIS; /** @@ -1237,7 +1238,7 @@ if ( ! function_exists( 'wp_redirect' ) ) : * @param int $status Status code to use. * @param string $location The path to redirect to. */ - $x_redirect_by = apply_filters( 'x_redirect_by', 'WordPress', $status, $location ); + $x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location ); if ( is_string( $x_redirect_by ) ) { header( "X-Redirect-By: $x_redirect_by" ); } diff --git a/tests/phpunit/tests/pluggable.php b/tests/phpunit/tests/pluggable.php index 9cbb2905c2..73b7aecea9 100644 --- a/tests/phpunit/tests/pluggable.php +++ b/tests/phpunit/tests/pluggable.php @@ -176,7 +176,8 @@ class Tests_Pluggable extends WP_UnitTestCase { ), 'wp_redirect' => array( 'location', - 'status' => 302, + 'status' => 302, + 'x_redirect_by' => 'WordPress', ), 'wp_sanitize_redirect' => array( 'location' ), '_wp_sanitize_utf8_in_redirect' => array( 'matches' ),