Seems there is a number of new people having issues with the Store Locator Plus® address lookup feature due to a failed REST API request. With Store Locator Plus 5 all address lookups are routed back through the WordPress site via the REST API in order to protect Google API keys.

If your site is running WordPress from a subdirectory you may run into issues if your web server is not configured to properly handle REST API routing. Especially if the site is using “pretty permalinks”, any Permalink setting under WordPress Settings | Permalinks other than “plain”.

The problem is that most of the Codex articles on the subject of doing a “WordPress in it’s own directory” installs came out well before the REST API existed. Most, dare we say ALL, have not been updated since and completely ignore the corner case of a WordPress subdirectory install with Permalinks enabled.

Permalinks REST API Rewrite Rule

Luckily you can fix this with a simple rule in your nginx website configuration via a rewrite rule. You can do the same with Apache, but you’ll have to figure out the proper Rewrite Conditionals to ensure you don’t rewrite everything. If you’re running subdirectory installs of WordPress we’ll assume you have a server admin that knows how to handle this.

Here is the partial Location matching rule and rewrite for the REST API with Permalinks enabled, assuming you’ve installed WordPress in a /wordpress/ subdirectory on your server:

       location /wordpress/ {
            rewrite ^/wordpress/wp-json/(.*?)$ /wordpress/index.php?rest_route=/$1 last;

Learn more at Lance’s technical blog about this issue.

Tired of web server configuration to keep your site running?

Our MySLP locator service doesn’t need all these special rewrite rules. We’ve bottled all the magic up in our JavaScript embed codes. You add your locations and adjust your map look-and-feel — then when you are ready past a JavaScript snippet into your website. It doesn’t even need to be running WordPress.