Google Maps Shortcode

For the Green Mountain Gamers site, I wanted to insert a shortcode for embedding Google Maps, as the visual editor strips out the iframes in which they come. This makes it difficult for anyone not used to toggling between the visual and HTML modes to edit a page without accidentally removing the embedded map.

First off, I tried a number of plugins, but they didn’t display the information quite the way I wanted it — one doesn’t include the ability to get directions to the displayed location! — or seemed excessively resource-intensive.

Then I started looking for a shortcode, something I could paste into functions.php of a theme. I found this post on, but the shortcode didn’t work right at first, due to something changing in Google’s API, I guess.

A little tinkering later and I discovered that if you add an attribute to the end of the eighth line of code, it’ll work again. At first, it looks like this:


Then you add &output=embed like this:


And the shortcode works again, embedding a map in the page using the format described in the DigWP post. I feel pretty proud for figuring that out on my own.


About Tyler

In the wilds of Vermont.
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s