Title: wpslCallback is not a function
Last modified: April 19, 2023

---

# wpslCallback is not a function

 *  [maikworld](https://wordpress.org/support/users/maikworld/)
 * (@maikworld)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/)
 * I haven’t been able to see any maps or dealers for a while. In the console I 
   get the error message “wpslCallback is not a function”. What could be the problem?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwpslcallback-is-not-a-function%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16669953)
 * You seem to be using some kind of optimization plugin? Can you disable it for
   a second and see if that fixed it? If so, then look for an option to exclude 
   the store locator page.
 *  Thread Starter [maikworld](https://wordpress.org/support/users/maikworld/)
 * (@maikworld)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16669963)
 * Hi Tijmen,
   there is a optimization plugin named “WP Super Cache”, but it is already
   disabled under Plugins. No other optimization plugins are used.
 *  Thread Starter [maikworld](https://wordpress.org/support/users/maikworld/)
 * (@maikworld)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16669969)
 * There is an update for “WP Store Locator – Widget”, but I can’t update this (“
   Update failed: Download failed. Unauthorized”). Is that the problem?
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16669981)
 * The auto complete function is probably active in the search widget? This indeed
   requires you to update the plugin. The error means the license key for the search
   widget is expired, but you can work around having to update the search widget
   by disabling the auto complete option.
 *  Thread Starter [maikworld](https://wordpress.org/support/users/maikworld/)
 * (@maikworld)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16669987)
 * The auto complete function is now disabled but there are no changes.
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16670002)
 * There’s a plugin modifying the script tags. 
   ‘data-waitfor = “maps.google.com/
   maps/api/js” for example is on the Google Maps script. Any idea where this comes
   from?
 *  Thread Starter [maikworld](https://wordpress.org/support/users/maikworld/)
 * (@maikworld)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16670035)
 * Nope. There isn’t any map stuff on this site. My client doesn’t even have a google
   map on the contact page. Are you sure, that this is not a script part from WP
   Store locator?
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16670055)
 * It looks like some kind of optimization script, and this may mess with the loading
   order of JS scripts, causing the error. It 100% not from the WP Store Locator
   [itself](https://plugins.trac.wordpress.org/browser/wp-store-locator/trunk/frontend/class-frontend.php#L1747).
 *  Thread Starter [maikworld](https://wordpress.org/support/users/maikworld/)
 * (@maikworld)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16670072)
 * I found it! It’s the Plugin “Complianz | GDPR/CCPA Cookie Consent”. Now it works.
   Thank you for your very quick and effective work.
 *  [markd33](https://wordpress.org/support/users/markd33/)
 * (@markd33)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/page/2/#post-16676152)
 * [@tijmensmit](https://wordpress.org/support/users/tijmensmit/) our fix looks 
   like the following:
 *     ```wp-block-code
       add_filter('script_loader_tag', 'gmap_scripts_defer', 10, 2);
       function gmap_scripts_defer($tag, $handle)
       {
       	if ($handle === 'wpsl-js') {
       		return str_replace(' src=', ' onload="document.dispatchEvent(new CustomEvent(wpslJsLoaded))" src=', $tag);
       	}
   
       	if ($handle === 'wpsl-gmap') {
       		preg_match('/<script.*?src=["\']+(.*?)["\']+/', $tag, $matches);
       		if (!isset($matches[1]) || empty($matches[1])) {
       			return $tag;
       		}
   
       		$tag = '<script>function initMapsScript(){const src = ' . str_replace('&', '&', $matches[1]) . ';const script = document.createElement(script);script.src = decodeURI(src);document.body.append(script);}
       							if(typeof wpsl === "undefined"){document.addEventListener(wpslJsLoaded, initMapsScript);} else {initMapsScript();}</script>';
       	}
       	return $tag;
       }
       ```
   
    -  This reply was modified 3 years ago by [markd33](https://wordpress.org/support/users/markd33/).
 *  [selina27](https://wordpress.org/support/users/selina27/)
 * (@selina27)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16680607)
 * [@tijmensmit](https://wordpress.org/support/users/tijmensmit/) I just now saw
   you tagged me in a response to this thread but i cannot find it anymore. I can
   try to change the php file 🙂
 *  Plugin Author [Tijmen Smit](https://wordpress.org/support/users/tijmensmit/)
 * (@tijmensmit)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16680805)
 * [@selina27](https://wordpress.org/support/users/selina27/) an admin deleted your
   comment because your supposed to start a [new thread](https://wordpress.org/support/forum-user-guide/faq/#i-have-the-same-problem-can-i-just-reply-to-someone-elses-post-with-me-too)
   instead of continuing in the one from someone else. If you need more help just
   open a support ticket [here](https://wpstorelocator.co/support/), or create a
   new thread. Do let me know if the code fixes it.
 *  [selina27](https://wordpress.org/support/users/selina27/)
 * (@selina27)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16680810)
 * Ah okay, i understand. Yes, the code fixed my issue 🙂
 *  [mandeeej](https://wordpress.org/support/users/mandeeej/)
 * (@mandeeej)
 * [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16717209)
 * I updated the search widget and it fixed the issue.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘wpslCallback is not a function’ is closed to new replies.

 * ![](https://ps.w.org/wp-store-locator/assets/icon-256x256.jpg?rev=1007784)
 * [WP Store Locator](https://wordpress.org/plugins/wp-store-locator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-store-locator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-store-locator/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-store-locator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-store-locator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-store-locator/reviews/)

 * 14 replies
 * 7 participants
 * Last reply from: [mandeeej](https://wordpress.org/support/users/mandeeej/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/wpslcallback-is-not-a-function/#post-16717209)
 * Status: not resolved