Support

Account

Home Forums Backend Issues (wp-admin) Defer loading Gmaps fields

Solved

Defer loading Gmaps fields

  • Hi,

    I have a page where I use a repeater field to add markers to a map. However, once there are a lot of markers, the loading of the page becomes really slow because it is loading all the maps. Would it be possible to defer the loading of google maps in the admin area when a repeater is collapse / when the map is not in the viewport?

  • Hi @supportjgp

    Conditionally defer loading depending on wether a repeater is collapsed or not is not possible. At least not in any way I can figure out. Sorry 🙂

    When we’ve had projects where we needed lots of maps/markers we built the architecture around that. So we created a custom post type which would each hold a single map (called Maps for example). Then in the relevant places we could just use a post field with multiple values or a relationship field to pull in all maps we wanted without performance issues 🙂

  • Hi,

    Another solution to this could be using an ACF addon that adds a new type of Google Map field allowing you to add more than one marker to the Map field. That way, instead of loading 1 map field for every marker, you could have 1 map field for theoretically as many markers as you need. That should not only make your admin page load a lot quicker but also make your markers a lot more manageable.

    https://wordpress.org/plugins/acf-google-map-field-multiple-markers

    I know I’m a bit late to this thread but I hope this helps someone 🙂

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

You must be logged in to reply to this topic.