This plugin requires WordPress 5.0 or greater.
This plugin requires WordPress 5.0
or greater.
This plugin requires an API key to interact with Google Maps. Without an API key maps will not be displayed.
To obtain an API key follow these steps:
1. Create a new project in the Google Developer’s console by clicking here and selecting Create new project
1. Name your project
1. Select HTTP referrers (web sites) for the Key restriction type
1. Enter the domains where your API key will be used
– Example: *.mysite.com
1. Click the Create button
1. Write your API key down in a safe place
1. Enter the API key into the plugin settings
1. Clear full page caching, if necessary
Note: The API key will be exposed publicly to generate the map. It is important to restrict your API key so others do not abuse it. The API key will be used, and displayed, in both the WordPress editor and the front end of the site.
Once you have saved an API key into the plugin settings simply enter a location, such as New York, NY, or a full address. You may also choose the map width, height, zoom level and toggle between an interactive map or a static image in the block settings, which are visible in the right-hand sidebar when the block is selected.
This plugin can be installed just like you would install any other WordPress plugin. Because Google Map embes require an API key you’ll need to provide a valid API key in plugin settings as well. See the detailed steps below.
5.0
/wp-content/plugins/
directoryRemove the server-side check for a valid Google Maps URL as it was failing and preventing the map from rendering in some environments. If an invalid Google Maps API key is provided, an error message from Google Maps will be rendered on the page.
Use the WordPress HTTP API instead of curl
to check the response code of the map URL. Additionally, cache the map URL response code in a transient to avoid making a request on each page load.
Hide the API key input section in the map block settings when the Google Map API key is defined with the GOOGLE_MAPS_API_KEY
constant. Additionally, add the api-key-input-container
class to the div
surrounding the API key input field in the map block settings for easier styling.
Aspect ratio bug fixes to address this WordPress.org issue.
1:1
aspect ratio incorrectly displaying as 2:1
16:9
ahead of 4:3
in the aspect ratio selection list so that the aspect ratios are in order of widthAllow non-admins to use the map block
The settings API endpoint requires the manage_options
capability. This is problematic because only administrators have that permission by default so any users with a lesser role cannot use the map block.
The saved API key and a boolean of whether the current user has the manage_options
capability are now passed to the block editor JS. Those values are used to determine if an API key is present. If it is not only users who have the manage_options
capability are shown an option to update the API key. Users without that capability are directed to ask an administrator to save the API key.
Once an API key is saved the block works as expected for users without the manage_options
capability as the API key is no longer fetched from the REST API for those users.
Remove wp-blocks dependency from block CSS registration
Enqueue block JavaScript in the footer
Add filter render_pantheon_google_map_block
Use InspectorControls
in wp.editor
rather than wp.blocks
as it will be deprecated in Gutenberg 3.1
Fix a bug retrieving API key from the database causing the map to not display on the frontend
create-guten-block
for building assets. hoek
which had a vulnerabilityregister_block_type
focus
to isSelected
wp.components
instead of wp.blocks.InspectorControls
4.9.2
to 4.9.5