The sensor parameter must be set true o false issue

I came across an unusual situation when a Statcomm user stumbled upon an error on his multisite environment. Every time he wanted to check the Statcomm console the following annoying error came up to the screen:

The Google Maps API server rejected your request. The “sensor” parameter specified in the request must be set to either “true” or “false”.

or in Spanish:

El servidor API de Google Maps ha rechazado tu solicitud. El parámetro “sensor” especificado en la solicitud debe estar definido en “true” o “false”.

Needless to say the the Instant Spy feature was disabled err , corrupted.

This is what I’ve learned and might you’ll find useful:

Statcomm uses Google Maps for his Instant Spy feature.The following code does the magic:

wp_register_script('googlemaps', '', FALSE, TRUE);

However, something was ‘cutting down’ the url to get only and hence the error  came up. Parameter sensor has to be there and somehow it wasn’t.

After a thoroughly revision, I came with the conclusion there was no other plugin conflicting with Statcomm, so I ended up with the only possible suspect: a nice theme called  Choices was causing the strange effect.

This is what I found on functions.php:

function _remove_script_version( $src ){
	$parts = explode( '?', $src );
	return $parts[0];
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );

This code was removing every parameter from url. You’ll find some useful questions regarding this filter on StackExchange.


There are few ideas to put in motion. The simplest one is to disable both filter altogether, but that could be unwise, affecting the theme inner working.

Since the current filters are far too generic, mangling everything it encounters, another idea could be to improve the function and see what parameters we are handling before returning only the url ($parts[0]).

I discarded these previous ideas because it implied to modify the theme, but I think that would be valid too.

Finally, another idea came from the user itself, Brent Wallace from Best Mobile Web Site Designer : what if we simplify the Google Map url using The ability of to compress urls including parameters was something I didn’t know at that time and it was interesting to try.

Here what I got:

function replace_url_google_maps()

    wp_register_script('googlemaps', '', FALSE, TRUE);

add_action('wp_print_scripts','replace_url_google_maps'); is the equivalent of but without using parameters.

The idea is very simple, to replace the original script url with parameters with another equivalente without any parameters. This only affect Statcomm plugin, leaving other themes an plugins untoched.

I hope you can apply this concepts in other situations.

1 Comment

  • Cant get information from wensite it says set sinsor parmeter to chose trur or false please walk me through this process thank you

Leave a Reply

Your email address will not be published Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>