wc_is_valid_url( string $url )
Simple check for validating a URL, it must start with http:// or https://.
Description Description
and pass FILTER_VALIDATE_URL validation.
Parameters Parameters
- $url
-
(Required) to check.
Return Return
(bool)
Source Source
File: includes/wc-conditional-functions.php
function wc_is_valid_url( $url ) { // Must start with http:// or https://. if ( 0 !== strpos( $url, 'http://' ) && 0 !== strpos( $url, 'https://' ) ) { return false; } // Must pass validation. if ( ! filter_var( $url, FILTER_VALIDATE_URL ) ) { return false; } return true; }