Skip to content

Instantly share code, notes, and snippets.

@brandonstephens
Last active February 16, 2016 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonstephens/084f72660437889d7e83 to your computer and use it in GitHub Desktop.
Save brandonstephens/084f72660437889d7e83 to your computer and use it in GitHub Desktop.
Phone Number or Empty Validation Patter for Advanced Custom Fields: Validated Field - Choose PHP Statement
<?php
if ( preg_match('/^\d{3,3}-\d{3,3}-\d{4,4}$/', $value) || strlen($value) == 0 ) {
return true;
} else {
return false;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment