From 73d785a307f2c72240fa205f1c5f7e25852f3cf9 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 6 Nov 2020 14:01:06 +0000 Subject: [PATCH] Docs: Improve return value description for `esc_url()`. Add a reference to `esc_url()` from `esc_url_raw()` return value description. Props stevenlinx, audrasjb, helen. Fixes #50585. git-svn-id: https://develop.svn.wordpress.org/trunk@49512 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 18be1171e6..6552110156 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -4301,6 +4301,8 @@ function esc_sql( $data ) { * Defaults to return value of wp_allowed_protocols(). * @param string $_context Private. Use esc_url_raw() for database usage. * @return string The cleaned URL after the {@see 'clean_url'} filter is applied. + * An empty string is returned if `$url` specifies a protocol other than + * those in `$protocols`, or if `$url` contains an empty string. */ function esc_url( $url, $protocols = null, $_context = 'display' ) { $original_url = $url; @@ -4408,7 +4410,7 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) { * @param string $url The URL to be cleaned. * @param string[] $protocols Optional. An array of acceptable protocols. * Defaults to return value of wp_allowed_protocols(). - * @return string The cleaned URL. + * @return string The cleaned URL after esc_url() is run with the 'db' context. */ function esc_url_raw( $url, $protocols = null ) { return esc_url( $url, $protocols, 'db' );