• 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 to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    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

    (@maikworld)

    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

    (@maikworld)

    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

    (@tijmensmit)

    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

    (@maikworld)

    The auto complete function is now disabled but there are no changes.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    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

    (@maikworld)

    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

    (@tijmensmit)

    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.

    Thread Starter maikworld

    (@maikworld)

    I found it! It’s the Plugin “Complianz | GDPR/CCPA Cookie Consent”. Now it works. Thank you for your very quick and effective work.

    @tijmensmit our fix looks like the following:

    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 1 year, 7 months ago by markd33.

    @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

    (@tijmensmit)

    @selina27 an admin deleted your comment because your supposed to start a new thread instead of continuing in the one from someone else. If you need more help just open a support ticket here, or create a new thread. Do let me know if the code fixes it.

    Ah okay, i understand. Yes, the code fixed my issue ??

    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.