WordPress phone Number Restrict to allow xxx-xxx-xxxx 格式
WordPress phone Number Restrict to allow xxx-xxx-xxxx Format
我已将占位符保留为 xxx-xxx-xxxx
<label> Phone Number </label> [number* shm-mrk-phone minlength:10 maxlength:140 placeholder "]
我更改了插件中的 tel 脚本 formatting.php
function wpcf7_is_tel( $tel ) {
$result = preg_match( '/^(?:\(\d{3}\)|\d{3}-)\d{3}-\d{4}$/', $tel );
return apply_filters( 'wpcf7_is_tel', $result, $tel );
}
它不允许 xxx-xxx-xxxx(这应该允许),它允许 xxxxxxxxxx
非常简单。我使用 tel
而不是号码类型来添加手机号码。
在 Contact Form 7 插件 formatting.php 模块中,
我更新了 wpcf7_is_tel
函数的代码。
function wpcf7_is_tel( $tel ) {
$result = preg_match( '/^(?:\(\d{3}\)|\d{3}-)\d{3}-\d{4}$/', $tel );
return apply_filters( 'wpcf7_is_tel', $result, $tel );
}
工作正常。
我已将占位符保留为 xxx-xxx-xxxx
<label> Phone Number </label> [number* shm-mrk-phone minlength:10 maxlength:140 placeholder "]
我更改了插件中的 tel 脚本 formatting.php
function wpcf7_is_tel( $tel ) {
$result = preg_match( '/^(?:\(\d{3}\)|\d{3}-)\d{3}-\d{4}$/', $tel );
return apply_filters( 'wpcf7_is_tel', $result, $tel );
}
它不允许 xxx-xxx-xxxx(这应该允许),它允许 xxxxxxxxxx
非常简单。我使用 tel
而不是号码类型来添加手机号码。
在 Contact Form 7 插件 formatting.php 模块中,
我更新了 wpcf7_is_tel
函数的代码。
function wpcf7_is_tel( $tel ) {
$result = preg_match( '/^(?:\(\d{3}\)|\d{3}-)\d{3}-\d{4}$/', $tel );
return apply_filters( 'wpcf7_is_tel', $result, $tel );
}
工作正常。