if ( !
rest_parse_date( $value ) ) { return new WP_Error( 'rest_invalid_date',
__( 'Invalid date.'
) );
} break;
case 'email':
if ( !
is_email( $value ) ) { return new WP_Error( 'rest_invalid_email',
__( 'Invalid email address.'
) );
} break;
case 'ip':
if ( !
rest_is_ip_address( $value ) ) { /* translators: %s: IP address. */
return new WP_Error( 'rest_invalid_ip',
sprintf( __( '%s is not a valid IP address.'
),
$param ) );
} break;
case 'uuid':
if ( !
wp_is_uuid( $value ) ) { /* translators: %s: The name of a JSON field expecting a valid UUID. */
return new WP_Error( 'rest_invalid_uuid',
sprintf( __( '%s is not a valid UUID.'
),
$param ) );
} break;
} }