wp_sanitize_redirect

Definition:
function wp_sanitize_redirect($location) {}

Sanitizes a URL for use in a redirect.

Parameters

  • $location

Return values

returns:redirect-sanitized URL

Source code

function wp_sanitize_redirect($location) {

	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!]|i', '', $location);

	$location = wp_kses_no_null($location);



	// remove %0d and %0a from location

	$strip = array('%0d', '%0a', '%0D', '%0A');

	$location = _deep_replace($strip, $location);

	return $location;

}

4075

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: