Return to Snippet

Revision: 60111
at October 21, 2012 02:45 by cyberhobo

Initial Code
class CustomGeoMashupWrap {

	static function add_slash_to_home_url( $url, $path, $scheme, $blog ) {
		return trailingslashit( $url );

	static function map_shortcode_wrapper( $args ) {
		add_filter( 'get_home_url', array( __CLASS__, 'add_slash_to_home_url' ), 10, 4 );
		$map = GeoMashup::map( $args );
		remove_filter( 'get_home_url', array( __CLASS__, 'add_slash_to_home_url' ), 10, 4 );
		return $map;

	function wrap_map_shortcode() {
		remove_shortcode( 'geo_mashup_map' );
		add_shortcode( 'geo_mashup_map', array( __CLASS__, 'map_shortcode_wrapper' ) );
add_action( 'init', array( 'CustomGeoMashupWrap', 'wrap_map_shortcode' ) );

Initial URL

Initial Description
Some hosting configurations do uncontrollable redirects and other oddities that play havoc with Geo Mashup maps. Most commonly the home URL redirects improperly unless a slash is added at the end. This code attempts to add the slash just for Geo Mashup. Put it in a theme functions.php or in mu-plugins.

Initial Title
Force Geo Mashup to use a different home URL (add a slash)

Initial Tags

Initial Language