Skip to content

Instantly share code, notes, and snippets.

@BruceMcKinnon
Last active March 20, 2018 00:22
Show Gist options
  • Save BruceMcKinnon/f8e09b3cb7399c9c95cb6c4114e14cc1 to your computer and use it in GitHub Desktop.
Save BruceMcKinnon/f8e09b3cb7399c9c95cb6c4114e14cc1 to your computer and use it in GitHub Desktop.
Gravity Form Australian Phone Number Filtering
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