esc_url


esc_url ( $url, $protocols = null, $_context = 'display' )

Parameters:
  • (string) $url The URL to be cleaned.
  • (array) $protocols Optional. An array of acceptable protocols. Defaults to return value of wp_allowed_protocols()
  • (string) $_context Private. Use esc_url_raw() for database usage.
Returns:
  • (string) The cleaned $url after the {@see 'clean_url'} filter is applied.
Defined at:

Description

Checks and cleans a URL.

A number of characters are removed from the URL. If the URL is for displaying (the default behaviour) ampersands are also replaced. The {@see 'clean_url'} filter is applied to the returned cleaned URL.

Related Functions

rest_url, esc_url_raw, esc_sql, home_url, esc_attr

Top Google Results

User discussions

wpseek mobile