diff --cc src/wp-includes/pluggable.php
index 994be2c1c1,994be2c1c1,994be2c1c1..4edb9929f6
--- src/wp-includes/pluggable.php
+++ src/wp-includes/pluggable.php
@@@@ -1271,9 -1271,9 -1271,9 +1271,6 @@@@ if ( ! function_exists( 'wp_sanitize_re
   	 * @return string Redirect-sanitized URL.
   	 */
   	function wp_sanitize_redirect( $location ) {
---		// Encode whitespaces.
---		$location = str_replace( ' ', '%20', $location );
---		
   		$regex    = '/
   		(
   			(?: [\xC2-\xDF][\x80-\xBF]        # double-byte sequences   110xxxxx 10xxxxxx
diff --cc tests/phpunit/tests/pluggable.php
index 28cc3cd462,28cc3cd462,28cc3cd462..e711f3b8bc
--- tests/phpunit/tests/pluggable.php
+++ tests/phpunit/tests/pluggable.php
@@@@ -319,20 -319,20 -319,20 +319,4 @@@@ class Tests_Pluggable extends WP_UnitTe
   		return $signatures;
   	}
   
---	/**
---	 * @group 36998
---	 */
---	function test_wp_sanitize_redirect_should_encode_whitespaces() {
---
---		$test_expected_and_values = [
---			'http://example.com/test%20whitespaces' => 'http://example.com/test%20whitespaces',
---			'http://example.com/test%20whitespaces%20in%20url' => 'http://example.com/test whitespaces in url'
---		];
---
---		foreach( $test_expected_and_values as $expected => $value ) {
---			$this->assertSame( $expected, wp_sanitize_redirect( $value ) );
---		}
---
---	}
---
   }
