Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 41183)
+++ src/wp-includes/formatting.php	(working copy)
@@ -2960,7 +2960,57 @@
 	/** This filter is documented in wp-includes/formatting.php */
 	return apply_filters( 'is_email', $email, $email, null );
 }
+/**
+ * Verifies url is valid as wordpress site url
+ * The regex check just if th protocol are http o https.
+ * In case other protocol are need to be considered valid, one has to edit the regex through the filter
+ *
+ * @param string $url Url address to verify.
+ *
+ * @return bool            False if it is not a valid wordpress site url
+ */
+function is_url( $url ) {
 
+	$valid_url_pattern = '~^ 
+ 		            (http(s)?)://                           # protocol 
+ 		            (([\pL\pN-]+:)?([\pL\pN-]+)@)?          # basic auth 
+ 		            ( 
+ 		                ([\pL\pN\pS-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name 
+ 		                    |                                                 # or 
+ 		                \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}                    # an IP address 
+ 		                    |                                                 # or 
+ 		                \[ 
+ 		                    (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]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})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) 
+ 		                \]  # an IPv6 address 
+ 		            ) 
+ 		            (:[0-9]+)?                              # a port (optional) 
+ 		            (?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )*      # a path 
+ 		        $~ixu';
+
+	/**
+	 * basic check before running the regex
+	 */
+	if ( empty( trim( $url ) ) ) {
+		return false;
+	}
+
+	/**
+	 * Filters to edit the regex pattern for a valid url
+	 *
+	 * @param string $valid_url_pattern The regex pattern to valid url against
+	 */
+	$valid_url_pattern = apply_filters( 'valid_url_pattern', $valid_url_pattern );
+
+	if ( ! preg_match( $valid_url_pattern, $url ) ) {
+
+		//is not a valid url
+		return false;
+	} else {
+
+		//is valid url
+		return true;
+	}
+}
 /**
  * Convert to ASCII from email subjects.
  *
