Validate::validate_is_email( object $field )

Description #

Validate is_email field.

Parameters #

  • $field
    object (Required) Instance of @see AP_Field object.

Source #

File: lib/class-validate.php

	public static function validate_is_email( $field ) {
		if ( ! empty( $field->value() ) && ! is_email( $field->value() ) ) {
			$field->add_error(
				'is-email',
				sprintf(
					// Translators: placeholder contain field label.
					__( 'Value provided in field %s is not a valid email.', 'anspress-question-answer' ),
					$field->get( 'label' )
				)
			);
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment