How can I limit the number of characters in the phone number attribute

how can I limit the number of characters in the phone number attribute

add_filter(
	'hivepress/v1/models/listing',
	function( $model ) {
		$model['fields']['tel']['max_length']   = 5;
		return $model;
	},
	1000
);

NOT WORKING

Hi,

Unfortunately, this snippet won’t work here, you need to change the pattern option, please check this sample:

​I hope this is helpful to you.

Sorry, but this is not what I asked, you can send a fragment to the phone attribute with the maximum allowed 5 characters.

Please make sure that the field name is correct, the snippet seems to be ok. If it still doesn’t work it may not be possible, because there’s a built-in array of parameters set for the Phone field type hivepress/includes/fields/class-phone.php at master · hivepress/hivepress · GitHub We’ll try to make it more flexible though.

Thank you, dear Ihor, you always help me in difficult situations, thank you, I solved the problem only thanks to you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.