If the map doesn’t load, or shows no results, then there are three likely problems:
- The wp_footer action is not called in your theme
- Access to admin-ajax.php is blocked
In the above example, the file path in the tooltip will look like this http://domain.com/wp-content/plugins/wp-store-locator/js/wpsl-gmap.js, which tells that you the error comes from the WP Store Locator plugin.
Once you have found the plugin that causes the error, contact the developer and ask them to fix the error, or you can find an alternative plugin that doesn’t produce any errors.
If the file path in the error doesn’t point to a plugin folder, but instead to another folder containing jquery.js for example, then the only way to determine which plugin is causing the error is by disabling the other plugins one by one until the error is gone.
Google Maps Errors
If the console error contains “Google Maps API error”, and you haven’t set an API browser key yet, then please create one. If you did set a key,Â this page will show you all the returned errors codes together with a short explanation of how to fix it.
Another Google Maps related error that can break the map is “You have included the Google Maps API multiple times on this page. This may cause unexpected errors.”
You can fix this by enabling the “Enable compatibility mode” option on the settings page.
More errors that are related to the Google Maps API are described here.
The wp_footer action is not called in your theme
You can check this by browsing to the page that contains the [wpsl] shortcode, viewing the source code ( right mouse click and select view source ), and searching (ctrl + f) for
If there are no matches then open the footer.php in your theme folder, and add the wp_footer action to the bottom of the file just before the
After you have made the changes, reload the page to see if the map loads now.
Access to admin-ajax.php is blocked
The store locator, like many other plugins, requires access to the admin-ajax.php to perform certain actions, in this case, to load store locations that fall within the selected radius.
Unfortunately, access to the admin-ajax.php is sometimes blocked by security plugins or by a rule that was added to the .htaccess file to protect your site from attacks. This can unintentionally prevent plugins from functioning properly.
You can test if the admin-ajax.php is accessible by trying to access it directly in your browser.
Assuming you didn’t install WordPress in a sub directory, the full URL to the admin-ajax.php (including the store locator parameters) will look like this:
Enter the above URL in the address bar of your browser, and reload the page.
If the admin-ajax.php is accessible, the response should either show
, or a list of store details.
If the page is redirected, or it shows an error message like Forbidden You don’t have permission to access /, then something is actively blocking access to the admin-ajax.php.
The most likely plugin type to cause a conflict are security plugins. They sometimes allow you to restrict access to files in the /wp-admin folder, which in this case breaks the store locator search.
If you use a security plugin, then look for a setting that allows you to block access to the admin-ajax.php file, or the whole /wp-admin folder. If there is one, disable it, and try to access the admin-ajax.php again.
If you don’t use a security plugin, try to deactivate other plugins and see if the admin-ajax.php becomes accessible again.
Another possibility is that a rule exists in the .htaccess file that blocks the access to the admin-ajax.php.
You can find the .htaccess in the root directory of your WordPress installation, but it’s also possible another one exists in the /wp-admin folder.
Open the .htaccess file and look for any rules that restrict the access to either the admin-ajax.php file or the /wp-admin folder itself.
You can see an example of what a basic WordPress .htaccess file looks like here. If your .htaccess file contains more rules, then try to remove them and see if that makes the admin-ajax.php accessible again.