GC_Customize_Manager::_validate_external_header_video()
最后更新于:2021-11-27 03:14:31
GC_Customize_Manager::_validate_external_header_video( GC_Error$validity, mixed$value)Callback for validating the external_header_video value.
参数
- $validity
-
(GC_Error) (Required)
- $value
-
(mixed) (Required)
响应
(mixed)
源文件
文件: gc-includes/class-gc-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;
}