Avoid creation of clickable links in forms

Is there a way to avoid clickable links being sent?
Like don’t create a link from a submitted URL or email address? But send it as text only?

I couldn’t find anything about. Your help is appreciated.

Are you talking about the notification email content or the admin interface?

Yeah, I’m talking about the notification emails. Is there a way to keep URLs or email addresses from automatically converting to clickable links?

You can use the following snippet to make the {all_fields} merge tag return the plain text value for emails and website fields.

add_filter( 'gform_merge_tag_filter', 'return_raw_email_all_fields', 10, 6 );
function return_raw_email_all_fields( $value, $merge_tag, $modifier, $field, $raw_value, $format ) {
	// Return raw value for email and website fields.
	if ( $merge_tag == 'all_fields' && ( $field->type == 'email' || $field->type == 'website' ) ) {
		return $raw_value;
	}
	// Other field type, return default value.
	return $value;
}

But note that most browsers automatically make emails and URLs clickable, so you may still see emails and links clickable.

1 Like

Thanks a lot. I’ll give it a try.

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