• Ulrich

    (@grapplerulrich)


    As of February 21st, 2024, google.maps.Marker is deprecated. Please use google.maps.marker.AdvancedMarkerElement instead. At this time, google.maps.Marker is not scheduled to be discontinued, but google.maps.marker.AdvancedMarkerElement is recommended over google.maps.Marker. While google.maps.Marker will continue to receive bug fixes for any major regressions, existing bugs in google.maps.Marker will not be addressed. At least 12 months notice will be given before support is discontinued. Please see https://developers.google.com/maps/deprecations for additional details and https://developers.google.com/maps/documentation/javascript/advanced-markers/migration for the migration guide.

    There is a notice in the console log. Would be cool if the change could be made. It seems a simple change.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Alan Fuller

    (@alanfuller)

    Hi, thanks for the note, as at least 12 months notice will be given it is a very low priority for me.

    However feel free to create a pull request for the GitHub repo if you feel so inclined https://github.com/alanef/simple-google-maps-short-code

    Thread Starter Ulrich

    (@grapplerulrich)

    Hi Alan,

    Yea, totally, this is low priority. I had a quick look at it. It would need an extention of the shortcode attributes to support the MapId.

    Sorry, I did not have time to create a PR, but here are the changes needed for this change. Thought this might save you a bit of time.

    1. Include the maker library when loading the maps &libraries=marker
    <script src="https://maps.googleapis.com/maps/api/js?key=<?php echo esc_attr( $atts['key'] ); ?>&libraries=marker"type="text/javascript"></script>

    2. Include the MapId from the short code attributes. Also extend the shortcode attribute.

    map_options['mapId'] = '<?php echo esc_attr( $map_options['mapId'] ); ?>';

    3. Change to the new Object

    var marker_<?php echo (int) $i; ?> = new google.maps.marker.AdvancedMarkerElement({
    Plugin Author Alan Fuller

    (@alanfuller)

    Thanks, very helpful .

    Alan

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘google.maps.Marker is deprecated’ is closed to new replies.