WP_Customize_Manager::_validate_external_header_video( WP_Error $validity, mixed $value )
Callback for validating the external_header_video value.
Description Description
Ensures that the provided URL is supported.
Parameters Parameters
- $validity
-
(WP_Error) (Required)
- $value
-
(mixed) (Required)
Return Return
(mixed)
Source Source
File: wp-includes/class-wp-customize-manager.php
public function _validate_external_header_video( $validity, $value ) { $video = esc_url_raw( $value ); if ( $video ) { if ( ! preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video ) ) { $validity->add( 'invalid_url', __( 'Please enter a valid YouTube URL.' ) ); } } return $validity; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |