The Map Doesn’t Load, or Shows no Results

If the map doesn’t load, or shows no results, then there are three likely problems:

Make sure that WordPress and all your themes and plugins are updated to the latest version.

There are JavaScript errors

The easiest way to check if there are any JavaScript errors is by opening the browser console. You can do this by pressing F12, and then navigate to the “console” tab. If any errors exist, then they will show up in red.

The error itself can sometimes help you find the plugin that causes the error. If you place your mouse cursor over the file name on the right side of the debug screen, then a tooltip will show up with the path of the JavaScript file where the error occurred.

Chrome debug

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.

There is also the possibility that there’s a conflict with a JavaScript file from your theme. You can check this by switching to a default WordPress theme and reloading the store locator page to see if the map will load correctly.

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.”

Console Multiple Google Maps API's

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

If this is the case, then the required JavaScript files are not included in the HTML output, which will prevent the map from loading.

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 var wpslSettings.

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 </body> tag.

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.

Plugin conflicts

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.

.htaccess rules

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.

If you don’t see a .htaccess file, then make sure your FTP client is configured to show hidden files.

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.