Last active
March 20, 2018 00:22
-
-
Save BruceMcKinnon/f8e09b3cb7399c9c95cb6c4114e14cc1 to your computer and use it in GitHub Desktop.
Gravity Form Australian Phone Number Filtering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'gform_phone_formats', 'au_phone_format' ); | |
function au_phone_format( $phone_formats ) { | |
$phone_formats['au'] = array( | |
'label' => 'Australia', | |
'mask' => false, | |
'regex' => '/^\({0,1}((0|\+61)(2|4|3|7|8)){0,1}\){0,1}(\ |-){0,1}[0-9]{2}(\ |-){0,1}[0-9]{2}(\ |-){0,1}[0-9]{1}(\ |-){0,1}[0-9]{3}$/', | |
'instruction' => false, | |
); | |
return $phone_formats; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment