_wp_sanitize_utf8_in_redirect()WP 4.2.0

URL encodes UTF-8 characters in a URL.

Pluggable function — this function can be replaced from a plugin. It means that this function is defined (works) only after all plugins are loaded (included), but before this moment this function has not defined. Therefore, you cannot call this and all functions depended on this function directly from a plugin code. They need to be called on plugins_loaded hook or later, for example on init hook.

Function replacement (override) — in must-use or regular plugin you can create a function with the same name, then it will replace this function.

No Hooks.

Return

String. URL-encoded version of the first RegEx match.

Usage

_wp_sanitize_utf8_in_redirect( $matches );
$matches(array) (required)
RegEx matches against the redirect location.

Notes

Changelog

Since 4.2.0 Introduced.

_wp_sanitize_utf8_in_redirect() code WP 6.4.3

function _wp_sanitize_utf8_in_redirect( $matches ) {
	return urlencode( $matches[0] );
}