Uses
Uses | Description |
---|---|
wp-includes/l10n.php: __() | Retrieve the translation of $text. |
wp-includes/formatting.php: esc_url_raw() | Performs esc_url() for database usage. |
Callback for validating the external_header_video value.
Ensures that the provided URL is supported.
(WP_Error) (Required)
(mixed) (Required)
(mixed)
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; }
Version | Description |
---|---|
4.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_manager/_validate_external_header_video