Skip to content
REDO Interactive

Google Map with multiple locations in WordPress (iframe)

How to build a map with several markers in Google My Maps and embed it in WordPress as a full-width iframe, using WPBakery as the example.

WordPress

We show how to create a map with several location markers in Google My Maps and embed it on a WordPress page as a full-width iframe. The solution needs no API key and no programming.

Embedding a map with an iframe works on any website, not only in WordPress. The example uses the WPBakery plugin, but you can paste the finished code into any editor that accepts custom HTML.

Requirements

  • a Google account (to create the map in Google My Maps),
  • a WordPress site with the WPBakery plugin (optional, any block with custom HTML works too).

The screenshots show the Polish admin interface of WordPress and Google My Maps; the title attribute in the code stays as shown and should be translated into your page language.

Preparing the page structure

We start with a container for the map. The map should fill the whole screen width, so we add a Row element with the Stretch row and content (no paddings) option enabled.

Screenshot 1: Row settings in WPBakery for a full-width map

Next, we add the built-in Google Maps widget to the container.

Screenshot 2: adding the Google Maps widget in WPBakery

The widget contains a field with an iframe showing a sample location and one marker. We replace it with our own map with several markers.

In the Map embed iframe field, we set width="100%" so that the map fills the container. We set height as needed. In this example the map is 600 px high.

<iframe
src="https://www.google.com/maps/d/u/0/embed?mid=1QTmn9yOG2tXlLBUP74v3efnE6Sansk5D"
width="100%"
height="600"
style="border:0"
loading="lazy"
title="Mapa lokalizacji"
allowfullscreen>
</iframe>

The frameborder attribute is obsolete, so we remove the border with the border:0 style. The loading="lazy" attribute defers loading the map until the visitor scrolls near it. The title attribute describes the frame for screen readers.

Creating a map with multiple markers in Google My Maps

First, we sign in to a Google account and open https://www.google.com/maps/about/mymaps/.

  1. We click the “Try” button (Polish UI: “Wypróbuj”) and create a new map.
  2. We enter the location where we want to add a marker. In our example it is Poznań.
  3. We click the marker icon and add the marker to the map.

Screenshot 3: searching for a location in Google My Maps

Screenshot 4: adding a marker to the map in Google My Maps

We add further markers with the same option. When the map is ready, we open the map menu, choose “Embed on my site” (Polish UI: “Umieść na mojej stronie”) and copy the generated code.

Screenshot 5: map embed code in the “Embed on my site” option

We paste the iframe generated by Google in place of the previous one. The code from Google has its own src with our map ID, and we replace its default dimensions with the ones from the previous step.

On the page, we get this view:

Screenshot 6: the finished map with several markers on a WordPress page

In Google My Maps we can refine the map further. We can draw a route between locations, change marker names and descriptions, pick a different base map and change pin colors.

Common problems

  • The map does not show for visitors: in the map’s sharing settings in Google My Maps, allow access for anyone with the link.
  • Changes to the map do not appear on the page: the map data is fetched live, but the browser or a cache plugin may serve an older version of the page for a while.
  • The map is too short or too narrow on phones: check the height value and, if needed, set it in CSS separately for small screens.

Summary

Embedding a map with an iframe is a simple task, but the standard share option in Google Maps shows only one place. Google My Maps offers more: several markers, routes, descriptions and custom colors. We paste the finished code into a WPBakery widget or any other HTML block.

You can find more WordPress tutorials in our list of articles: insights.

← Insights on online stores, websites and code

Start with a conversation

Describe the situation or book a 30-minute call. You talk to the people who will design and build the solution.

REDO Helper

REDO Helper AI assistant

Thank you, your message has been sent. We will get back to you as soon as we can.

Cookies for visit statistics are set only after you agree. Privacy policy