WordPress Google Maps Guide: Embed With or Without a Plugin
01.03.2022 14:53 4.820 Displayed

WordPress Google Maps Guide: Embed With or Without a Plugin

Like a lot of things in WordPress, there are several different ways that you can embed Google Maps on your site depending on what type of map content you want to include.

In this post, we’ll start by showing you how to add Google Maps in WordPress without a plugin. Then, we’ll recommend some plugins that can help you embed Google Maps, as well as some of the benefits of going that approach. We’ll also dive into how to properly use the Google Maps API, which is now required.

Finally, we’ll end with some performance considerations for using Google Maps on WordPress and share some tips on how to keep your WordPress site loading fast even if you do need to embed Google Maps.

You can click below to jump straight to a specific section or just read through the whole thing.

Google Maps API is Now Required

As of June 11, 2018, an API key is now required for Google Maps. If you’ve already implemented Google Maps on your site and it’s no longer working, this might be the reason. Or rather, you’re missing the API key. The good news is, for 99% of you, it should still be free. Below is the Google Maps API pricing.

WordPress Google Maps Guide: Embed With or Without a Plugin | Atak Domain Hosting

 Google Maps API pricing

Google also gives you a recurring $200 credit on your billing account each month to offset your usage costs. So as you can see unless your generating thousands of requests, using Google Maps on your site shouldn’t cost you anything.

What else has changed? Nothing, but you will now need to do the following if you want to use Google Maps in WordPress:

  1. Sign up for a Google Cloud Platform Console account and configure it.
  2. Add your billing info, even though you might not ever be billed.
  3. Add the API key to your Google Maps embed code or plugin settings.

How to Get a Google Maps API Key

Below are steps on how to get your Google Maps API key.

Step 1

Go to the Google Cloud Platform Console. If you don’t have an account yet, create one, it’s free.

Step 2

Select or create a project.

Step 3

Set up your billing account. Even though they will require you to put a credit card on file, you should never be charged, unless you do go over the high usage limits.

Step 4

You will be asked to pick one or more products. This depends on the type of map you’re using. For example, if you are embedding a map on your WordPress site without a plugin (as shown in the steps further below), then you would pick the Google Maps Embed API.

WordPress Google Maps Guide: Embed With or Without a Plugin | Atak Domain Hosting

 Google Maps Embed API

If you are using a plugin like Google Maps Widget (as shown in the steps further below), then you would choose the Google Maps Static API.

If you’re using a third-party plugin or theme, they should have documentation on which type of Google Maps deployment they are using. Don’t worry, you can always add multiple types and change these later on.

Step 5

Click “Enable.”

WordPress Google Maps Guide: Embed With or Without a Plugin | Atak Domain Hosting

 Enable Google Maps API

Step 6

Click on “APIs” and then under “Credentials”, you will see your API key.

WordPress Google Maps Guide: Embed With or Without a Plugin | Atak Domain Hosting

 Google Maps API key

Step 7

If you’re simply embedding your Google Maps API key it will show in plain text in your source code. Therefore you should restrict this, otherwise, people could use your API key on their WordPress site or projects and rack up your usage.

To do this, simply click on your API key’s name and it will allow you to add a restriction. For your WordPress site, simply adding an HTTP referrer should be good enough. Such as https://yourdomain.com/*. This will allow it to only make calls on your website.

WordPress Google Maps Guide: Embed With or Without a Plugin | Atak Domain Hosting

 Google Maps API key restriction

How To Add Google Maps In WordPress Without A Plugin

If you just want to embed a simple map and don’t need more detailed functionality like custom location markers or other annotations, you can embed Google Maps without a plugin using the normal Google Maps website that you use on a daily basis.

Here’s how it works…

Step 1: Copy The Google Maps Embed Code

To get started, use the Google Maps website to create the map that you want to embed.

For example, if you want to embed a place marker, open that place in Google Maps. Or, if you want to embed directions, open the directions in Google Maps.

Once you have the map that you want to embed, click on the hamburger menu in the top-left corner:

WordPress Google Maps Guide: Embed With or Without a Plugin | Atak Domain Hosting

 How to access the embed code

In the list of menu items, select the option for Share or embed map:

WordPress Google Maps Guide: Embed With or Without a Plugin | Atak Domain Hosting

 Open the embed options

That will open up a Share popup. In that popup, click on the Embed a map tab.

Then, you can choose your desired size using the drop-down. For most WordPress sites, the default size works well, but you can make the map larger or smaller if needed.

Once you’ve done that, click on the Copy HTML button to copy the embed code: