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

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

Performs esc_url() for database or redirect usage.

Description Description

See also See also

Top ↑

Parameters Parameters


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


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

Default value: null

Top ↑

Return Return

(string) The cleaned URL.

Top ↑

Source 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 );

Top ↑

Changelog Changelog

Version Description
2.8.0 Use esc_url_raw()
2.3.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.