how to validate phone number field in advanced custom field on wordpress.Minimum number and maximum number and type only number.
/^(\d[\s-]?)?[([\s-]{0,2}?\d{3}[)]\s-]{0,2}?\d{3}[\s-]?\d{4}$/i
how to validate phone number field in advanced custom field on wordpress.Minimum number and maximum number and type only number.
/^(\d[\s-]?)?[([\s-]{0,2}?\d{3}[)]\s-]{0,2}?\d{3}[\s-]?\d{4}$/i
If you don't want to develop your own code, you can use the Advanced Custom Fields plugin (https://wordpress.org/plugins/validated-field-for-acf/) and then use RegEx to define the allowed phone number pattern for example:
/^(\d[\s-]?)?[\(\[\s-]{0,2}?\d{3}[\)\]\s-]{0,2}?\d{3}[\s-]?\d{4}$/i
This pattern will work for a range of phone numbers but you can adapt the RegEx to your specific requirements. There already is a post on phone number validation at: A comprehensive regex for phone number validation
I hope this helps.