Redirect to the single post on marker click

In this tutorial, you’ll see how to use the marker click event to redirect/open the single post page.

Edit the file “functions.php” of your theme/child theme and copy/paste the following code in it:

 * Redirect to single post on marker click 

function cspm_redirect_on_marker_click_event($default, $map_id){
	$output = "
			exec: {
				name: 'marker',
				all: true,
				func: function(data){
					var marker = data.object;
					var post_id = marker.post_id;
					var post_link = progress_map_vars.links_".$map_id."[post_id];
					marker.addListener('click', function(){;
	echo $output;
add_filter('cspm_after_map_load', 'cspm_redirect_on_marker_click_event', 10, 2);

In the same context