You can add custom phone number validation by adding the code below in your theme functions.php file
add_filter( "adverts_form_load", function( $form ) {
if( $form["name"] != "advert" ) {
return $form;
}
foreach( $form["field"] as $k => $f ) {
if( $f["name"] == "adverts_phone" ) {
$form["field"][$k]["validator"][] = array( "name" => "my_is_phone_number");
}
}
return $form;
});
function my_is_phone_number( $data ) {
if(preg_match("/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/", $data)) {
return true;
} else {
return "invalid";
}
}
In the preg_match() function you just need to update the patter to allow the phones in your desired format.