W3cubDocs

/WordPress

sanitize_url( string $url, array $protocols = null )

This function has been deprecated. Use esc_url_raw() instead.

Performs esc_url() for database or redirect usage.

Description

See also

Parameters

$url

(string) (Required) The URL to be cleaned.

$protocols

(array) (Optional) An array of acceptable protocols.

Default value: null

Return

(string) The cleaned URL.

Source

File: wp-includes/deprecated.php

function sanitize_url( $url, $protocols = null ) {
	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' );
	return esc_url_raw( $url, $protocols );
}

Changelog

Version Description
2.8.0 Use esc_url_raw()
2.3.1 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/sanitize_url