Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

SEO & AI search · Guide

How to Embed Google Maps in WordPress (Step by Step)

How to Embed Google Maps in WordPress (Step by Step)

Short answer

Open Google Maps, search for your location, click Share, choose Embed a map and copy the HTML code. In WordPress, add a Custom HTML block to your page, paste the code and publish. This method is free and needs no plugin or API key.

Key takeaways

  • The Share > Embed a map code from Google Maps needs no plugin or API key.
  • Paste the iframe into a Custom HTML block, or the Text tab in the Classic Editor.
  • Change the width to 100% so the map fits phone screens.
  • Page builders such as Elementor have a map widget that only needs an address.
  • API keys are only needed for the Maps Embed API, the JavaScript API or plugins that use them.
  • Keep lazy loading on and consider cookie consent for embedded maps.

What is the easiest way to embed Google Maps in WordPress?

Copy the embed code from Google Maps and paste it into a Custom HTML block; it needs no plugin, no API key and takes about two minutes.

There are four common methods. Pick the one that fits your site:

MethodAPI key neededBest for
Google Maps share code in a Custom HTML blockNoMost sites, one or two maps
Page builder map widget (Elementor, Divi and others)Usually noSites already built with a builder
Maps Embed API iframeYesCustom map modes and settings
Map pluginDepends on the pluginMany locations, store locators

For a contact page or a single business location, the share code method is all you need. The rest of this guide covers each option.

How do you get the embed code from Google Maps?

Search for your place in Google Maps, click Share, open the Embed a map tab, choose a size and copy the HTML code.

Step by step:

  1. Open Google Maps in your browser.
  2. Search for your business name or full address.
  3. Click the Share button in the place panel.
  4. Switch to the Embed a map tab.
  5. Pick a size such as Medium or Large, or choose a custom size.
  6. Click Copy HTML.

The code you copy is an iframe element. It points to a google.com maps address and includes a width, height and lazy-loading setting. Google describes the steps in its help article on embedding a map.

If your business has a Google Business Profile, search for the business name rather than the street address. The embedded map then shows your business pin and name.

How do you add the map with the block editor?

Add a Custom HTML block where you want the map, paste the iframe code, and switch to preview to check it before saving.

In detail:

  1. Edit the page, often your contact page.
  2. Click the plus button and search for Custom HTML.
  3. Paste the code from Google Maps into the block.
  4. Click Preview in the block toolbar to see the map.
  5. Update or publish the page.

WordPress documents this block on its Custom HTML block page. The block keeps your code exactly as pasted, which is why it works for iframes.

If you use the Classic Editor, switch to the Text tab and paste the code there. Pasting into the Visual tab will show the code as plain text instead of a map.

New to editing pages? Our guide on how to edit a page in WordPress covers the editor basics.

How do you make an embedded Google Map responsive?

Change the iframe's width to 100% so it fills its container, and keep a fixed height or an aspect ratio so it does not collapse on phones.

Google's code uses a fixed pixel width, such as 600. On a phone, that can overflow the screen.

The simplest fix is to edit the pasted code. Change width=“600” to width=“100%” and leave the height as it is, for example height=“450”.

For a map that keeps its shape, add a small style instead:

<iframe src="YOUR-MAP-URL" style="width:100%;aspect-ratio:4/3;border:0" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>

Replace YOUR-MAP-URL with the src value from Google's code. The aspect-ratio property is supported by current browsers, as shown on MDN's aspect-ratio page.

How do you embed Google Maps with Elementor or another page builder?

Drag the builder's Google Maps widget onto the page and type your address or place name; the builder generates the embed for you.

In Elementor, search the widget panel for Google Maps. Drop it into a section, type the location and set the zoom and height. The free version includes this widget.

Most builders work the same way. Divi, Beaver Builder, Kadence Blocks and Spectra all have a map element with an address field.

If you are new to the builder, our guide on how to use Elementor in WordPress explains widgets and sections.

When do you need a Google Maps API key?

You need an API key only for the Maps Embed API, the Maps JavaScript API, or plugins built on them; the basic share code from Google Maps does not need one.

The Maps Embed API gives you more control. It supports modes such as place, directions, search and street view through a URL with your key. Google explains the options in its Maps Embed API documentation.

To get a key, you create a project in the Google Cloud console, turn on the API and create a credential. Restrict the key to your domain so others cannot use it.

Google's pricing and free usage limits differ between its map APIs and change from time to time. Check the current Google Maps Platform pricing page before choosing a plugin that uses the JavaScript API.

Should you use a Google Maps plugin?

Use a plugin only when you need features the share code cannot do, such as many markers, a store locator, custom map styles or a map block with settings.

Plugins are helpful for directories, franchises and stores with many locations. Some add a dedicated block to the editor. For example, Embed Maps Block is one free option in the plugin directory.

Before installing, check when the plugin was last updated and whether it needs an API key. Every extra plugin adds code to maintain. Our guide on free vs premium WordPress plugins can help you choose.

Does an embedded Google Map slow down your site?

Yes, a map loads extra scripts and images from Google, but lazy loading delays it until visitors scroll near it, which keeps the first page load fast.

Google's share code already includes loading=“lazy”. Keep that attribute if you edit the code.

If the map sits at the very top of the page, lazy loading will not help much. Consider a static map image linked to Google Maps instead. Our guide to lazy loading in WordPress explains how the technique works.

They can, because loading a Google map may send visitor data to Google and set cookies, which matters under privacy laws such as the GDPR.

This is general information, not legal advice. If you serve visitors in regions with strict privacy rules, many site owners block the map until the visitor accepts cookies. Most consent plugins can do this for iframes.

Our guide on adding a cookie consent banner to WordPress covers the common tools.

Can an embedded map help your local SEO?

An embedded map helps visitors find you, but it is not a strong ranking factor on its own; consistent business details and schema markup matter more.

Put your name, address and phone number as plain text near the map. Search engines can read that text, while they read little from an iframe.

Adding local business schema gives search engines structured details about your location. Our guide on adding local business schema in WordPress shows how.

Why is your embedded Google Map not showing?

Maps usually fail to show because the code was pasted into the wrong place, your user role cannot save iframes, or a security or consent plugin is blocking it.

Check these causes:

  • Wrong editor mode. Paste the code into a Custom HTML block or the Classic Editor's Text tab.
  • User permissions. Only roles with the unfiltered_html capability can save iframes. On multisite, only super admins have it by default.
  • Consent plugins. The map may be hidden until visitors accept cookies.
  • Caching. Clear your cache plugin after adding the map.
  • Bad key. If you use an API key, a missing or restricted key shows a gray error box.

Open the page in a private window to see what visitors see. If the map works there, your own browser or login state was the cause.

If the map still will not appear, open your browser's developer tools and check the Console tab. A blocked iframe usually shows a clear message there, such as a content security policy or consent script stopping it.

Security plugins and some hosts add a content security policy header that only allows frames from approved domains. If that is the cause, add google.com to the allowed frame sources in the plugin or ask your host to update the header.

Frequently asked questions

Is it free to embed Google Maps in WordPress?

Yes. Copying the embed code from Google Maps and pasting it into a Custom HTML block is free and needs no API key. Costs only come into play with some Google Maps Platform APIs used by advanced plugins, so check Google's current pricing if you use those.

Why does my Google Maps code show as text instead of a map?

You probably pasted it into a Paragraph block or the Classic Editor's Visual tab. Delete it and paste the code into a Custom HTML block, or into the Text tab of the Classic Editor, so WordPress treats it as HTML.

Can I embed Google Maps directions in WordPress?

Yes. Plan the route in Google Maps, then use Share and Embed a map to copy the code for that view. For more control over directions, the Maps Embed API has a directions mode, which requires an API key.

How do I add a Google Map to my WordPress footer?

In a block theme, open Appearance > Editor, edit the footer template part and add a Custom HTML block with the map code. In a classic theme, go to Appearance > Widgets and add a Custom HTML widget to the footer area.

Why can my editor not save the Google Maps iframe?

WordPress only lets roles with the unfiltered_html capability save iframe code. Administrators have it on single sites, but editors and authors on multisite do not. Ask an administrator to add the map, or use a map block or plugin instead.

Sources

  1. Embed a map or route Google Maps Help
  2. Maps Embed API: Get started Google for Developers
  3. Custom HTML block WordPress.org
  4. aspect-ratio MDN Web Docs
  5. Embed Maps Block WordPress.org Plugin Directory

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.