Download GDPR Compliance WordPress Plugin in just $9 today.

is it possible to dynamically add markers to a map based on post content? I’m using the WP meta box on posts to add the location information to the map, and I also have a search & filter function on my site that displays posts based on whatever the user wants to filter them as, so I’m trying to get both (search form and maps) to work together. I’m using the shortcode to display the map, and I’m using a shortcode to display the search and filter form. I’m trying to figure out the loop to be able to tell the maps to look at the post results first before adding any markers and to only display the markers that match the posts from the search form.

I’m using this hook in my function.php file, and I would like the markers to only show if the search form returned certain locations:


function add_markers($markers,$map_id)
return $markers;

What is the code that matches the marker id to the post title when displaying markers on a map?

You do not have permission to view answers

Please login or Register to Submit Answer