sanitize_url() – Sanitizes a URL for database or redirect usage.

You appear to be a bot. Output may be restricted

Description

Sanitizes a URL for database or redirect usage.

Usage

$string = sanitize_url( $url, $protocols );

Parameters

$url
( string ) required – The URL to be cleaned.
$protocols
( string[] ) optional – Optional. An array of acceptable protocols. Defaults to return value of wp_allowed_protocols().

Returns

string The cleaned URL after esc_url() is run with the 'db' context.

Source

File name: wordpress/wp-includes/formatting.php
Lines:

1 to 3 of 3
function sanitize_url( $url, $protocols = null ) {
  return esc_url( $url, $protocols, 'db' );
}
 

 View on GitHub View on Trac