In WP the Contact Form 7 is a standout amongst the most famous modules for making contact shapes. One thing that you may have seen however is that the approval of the URL field won’t fall flat when you anticipate that they will come up short. For instance, with the URL estimation of https://ikodes.net, the module will think about this as a substantial URL, despite the fact that, the URL esteem is missing best level space part. The answer to this issue is to have a custom approval for the URL field. This article will demonstrate to you generally accepted methods to accomplish that.
Including our own URL approval utilizing wpcf7_is_url channel
Our custom URL approval will be genuinely straightforward. On the off chance that the default URL approval of the module is legitimate, we complete one extra approval utilizing a regex articulation that will attempt to approve a space name. There are numerous standard articulations on the web for space name approval, the one I use in the code beneath appears to work entirely well. On the off chance that regex approval bombs, at that point we set $result to FALSE, which will flag the module to show “URL appears to be invalid.” blunder message.
In the functions.php of your theme, add the following code:
function ikodes_contact7_check( $result, $url )
{
if ($result)
{
$regex='@^(https?://)?(www.)?([a-z0-9]([a-z0-9]|(-[a-z0-9]))*.)+[a-z]+$@i';
if (!preg_match($regex,$url)) $result=FALSE;
}
return $result;
}
add_filter( 'wpcf7_is_url', 'ikodes_contact7_check', 10, 2 );