# Adding Map It link to Advanced Post Creation

**URL:** <https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761>\
**Category:** Get Help\
**Tags:** google-maps\
**Created:** [February 5, 2021, 8:12pm UTC](https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761 "2021-02-05T20:12:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![user601da143cdb10517](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user601da143cdb10517/32/2507_2.png) [@user601da143cdb10517](https://community.gravityforms.com/u/user601da143cdb10517)\
**Post date:** [February 5, 2021, 8:12pm UTC](https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761/1 "2021-02-05T20:12:45Z")

</div>

Hello!  
I am using the Advanced Post Creation addon with the Address field.  
I would like to have a simple link to a Google Map without having to build out a custom function. The same “map it” link found in the entry view would be acceptable in my use case. Is this possible? I have attempted to use the `[gravityform]` shortcode with urlparams found in this solution: [https://community.gravityforms.com/t/display-address-value-in-content-and-or-map-dynamically-resolved/5381](https://community.gravityforms.com/t/display-address-value-in-content-and-or-map-dynamically-resolved/5381) but not working form.  
Thank you.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [February 10, 2021, 6:51pm UTC](https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761/2 "2021-02-10T18:51:49Z")

</div>

Hi Frederick. Can you explain where you want to use this link to a Google Map? Are you showing that on the confirmation page, or sending that in the email notification, or something else?

Also, we’ll need to see your form (please share the URL to the page on your site where we can see the form) to know the IDs of the address parts that should be included in the link to Google Maps. Thank you

---

<div class="post-metadata">

**Author:** ![user601da143cdb10517](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user601da143cdb10517/32/2507_2.png) [@user601da143cdb10517](https://community.gravityforms.com/u/user601da143cdb10517)\
**Post date:** [February 11, 2021, 5:14pm UTC](https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761/3 "2021-02-11T17:14:55Z")

</div>

@chrishajer

I want to use the this address link in the Advanced Post Creation feed under the Post Content section.

I have also included a Gist to the details of the issue.  
I have received some offline help and assistance with the issue. But I know it can be better or there may be another solution.

 ![Screen Shot 2021-02-11 at 12.17.28 PM](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/c/cb3ed06ffd6ff003cf056e061defa4be9d03efbd.png)  
Firstly, is there a way to call the Map It function that shows on the Entry View page into the Advanced Post Creation fields?

[https://gist.github.com/oneblackcrayon/41712abe04c872e4924db7f31d7bf946](https://gist.github.com/oneblackcrayon/41712abe04c872e4924db7f31d7bf946)

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [February 12, 2021, 10:13pm UTC](https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761/4 "2021-02-12T22:13:50Z")

</div>

Hi Frederick. The function that creates the map it link is not callable, so you won’t be able to use that to create the link in your post body. This is what that code returns though:

```auto
"<br/><a href='http://maps.google.com/maps?q={$address_qs}' target='_blank' class='map-it-link'>Map It</a>";

```

That’s all there is to it. You combine all parts of the address field into one, and send the whole thing to `http://maps.google.com/maps?q=`. That link in our code is outdated, and should be updated to this: `https://www.google.com/maps/?q=`

In your post body, it would look something like this, if I copied your merge tags correctly:

```auto
<a href='https://www.google.com/maps/?q={:10.1} {:10.2} {:10.3} {:10.4} {:10.5} {:10.6}' target='_blank' class='map-it-link'>Map It</a>

```

That’s a simple version of doing the same thing that the Gravity Forms core code is doing. Have you tried something like that?

---

<div class="post-metadata">

**Author:** ![user601da143cdb10517](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user601da143cdb10517/32/2507_2.png) [@user601da143cdb10517](https://community.gravityforms.com/u/user601da143cdb10517)\
**Post date:** [February 17, 2021, 3:27pm UTC](https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761/5 "2021-02-17T15:27:39Z")

</div>

Hello Chris,  
This is the solution I came up with but I think I need to add the data to ACF.  
Thank you for your example as it helped me figure out that I would want to `urlencode` the data from the input fields first, then `sanitize_text_field` to remove extra spacing.

```auto
    add_action( 'gform_pre_submission_31', 'gf_address_fields_to_acf_fields' );
    function gf_address_fields_to_acf_fields( $entry, $form ) {
    // For use with ACF if possible
	
    global $post;
	global $wp_query;
	$post_id = get_the_ID();
    // End ACF additional code

	$gf_address_fields = urlencode(
		rgpost( 'input_10_1' ) .' '.rgpost( 'input_10_2' ) .' '.rgpost( 'input_10_3' ) .' '.rgpost( 'input_10_4' ) .' '.rgpost( 'input_10_5' )
	);
	$_POST['input_19'] = sanitize_text_field( $gf_address_fields );

	error_log( print_r( $gf_address_fields, true ) );

	// Let's save it so we can use it with ACF?

}

```

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [February 17, 2021, 6:04pm UTC](https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761/6 "2021-02-17T18:04:12Z")

</div>

Very cool. Thank you for sharing.

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [January 5, 2022, 8:42am UTC](https://community.gravityforms.com/t/adding-map-it-link-to-advanced-post-creation/7761/7 "2022-01-05T08:42:32Z")

</div>

Closed on January 5, 2022, 8:42am UTC


