Gravity Forms – Disable and Remove the “Map It” Link

In the Gravity Forms generated emails, if your form has a “address” field the email notification generated by using something like {all_fields} will have a “Map It” link associated with the address, which will open Google Maps.

Add this code to your theme’s `functions.php` file to disable / remove the “Map It” link from the email notification.

// code courtesy of https://techblog.willshouse.com/?p=5249
add_filter(“gform_pre_send_email”, array($this,’gform_pre_send_email’));
function gform_pre_send_email($email)
{

// attempt to match the link using a regular expression
$test = preg_replace(“#\]+?\>Map It[^>]+\>#i”, ”, $email[“message”]);
// if the result is not empty / blank, use it to replace the original html
if(trim($test))
{
$email[“message”] = $test;
}

return $email;

}

If you want to hide the “map it” link from the HTML that is displayed on a webpage ( if you confirmation has the {all_fields} merge replacement in it ) then you can add some CSS like this:

Related Posts:

  • No Related Posts
This entry was posted in Tech Tips, Web Development and tagged , . Bookmark the permalink.

2 Responses to Gravity Forms – Disable and Remove the “Map It” Link

Leave a Reply

Your email address will not be published. Required fields are marked *