By default, marker click usually opens an infobox, popup, or media format. This recipe forces a redirect / new window to the single post when a marker is clicked.
Add to your child theme functions.php (or a snippets plugin):
/**
* Open the single post when a Progress Map marker is clicked.
*/
function cspm_redirect_on_marker_click_event( $default, $map_id ) {
$output = "
plugin_map.gmap3({
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(){
window.open(post_link);
});
}
}
});
";
echo $output;
}
add_filter( 'cspm_after_map_load', 'cspm_redirect_on_marker_click_event', 10, 2 );
Notes
window.open(post_link)opens a new tab/window. Usewindow.location.href = post_link;for same-tab navigation.- If you only need this on one map, wrap the JS echo in
if ( (string) $map_id === '55' )(your map ID). - This can conflict with infobox-on-click — disable overlapping behaviours or accept both firing.
- Prefer admin “Post URL” / modal settings when they already cover your case — see Open post in modal.
