Geolocation Blocked by a Permissions-Policy Header

If auto-locate never finds the visitor and the “Use my current location” button says permission was denied, your site probably sends a Permissions-Policy header with geolocation=(). Change it to geolocation=(self) wherever the header is set. WP Store Locator can’t override this header, but from version 3.1 it shows an alert on the Home page when it finds it.

Symptoms

The browser refuses every location request on the page, without asking the visitor. You’ll see one or more of these:

  • With “Attempt to auto-locate the user” on, the store locator always shows the stores around the start location, never around the visitor. No location prompt appears.
  • Clicking the “Use my current location” button on the map shows the message “The application does not have permission to use the Geolocation API.”, even though the visitor never refused.
  • The browser console (F12) shows a “Permissions policy violation” message about geolocation
  • From WP Store Locator 3.1, an alert on the Store Locator Home page says your site sends a header that blocks location access.

Check whether your site sends the header

  1. Open the page with the store locator in Chrome or Edge.
  2. Press F12 to open the developer tools and go to the Network tab.
  3. Reload the page and click the first request in the list (the page itself).
  4. Under Response Headers, look for Permissions-Policy.

Geolocation is blocked when that header contains:

Value Blocks geolocation?
geolocation=() Yes, for every page, your own included
geolocation=("https://example.com"), without self Yes, only the listed site may use it
geolocation=(self) No
geolocation=* No
No geolocation entry, or no header at all No

The header often lists several features at once, for example camera=(), microphone=(), geolocation=(). Only the geolocation part matters for the store locator.

Find where the header comes from

WordPress and WP Store Locator never send this header. Something else on your site adds it, usually because a security guide or plugin recommended it.

A quick test narrows it down. In the same Network tab, click an image or a CSS file from your own site and look at its Response Headers:

  • The image or CSS file has the header too: it comes from the server, .htaccess, your host or your CDN.
  • Only the pages have it: it comes from a WordPress plugin or your theme.
Source How to recognise it
A security or headers plugin Only pages have the header. It goes away when you deactivate the plugin.
.htaccess (Apache, LiteSpeed) A Header set Permissions-Policy or Header always set Permissions-Policy line, often copied from a security headers guide.
nginx config An add_header Permissions-Policy line. Usually set by your host or a server panel such as RunCloud.
Host or CDN header rules The header stays after you deactivate all plugins and it’s not in .htaccess. Check the response header rules in your host’s panel or CDN dashboard.
Theme or code snippet A header() call or a wp_headers filter in functions.php or a code snippets plugin.

Fix it

Change only the geolocation part to geolocation=(self) and leave the rest of the header alone. (self) lets your own pages ask for the location while embedded content from other sites stays blocked, so you keep the security benefit.

In a security or headers plugin

Plugin Where to change it
HTTP Headers Settings > HTTP Headers > Security > Permissions-Policy. Set the geolocation dropdown to self. It starts on none when you tick geolocation.
Defender Defender > Settings > Security Policies > Permissions-Policy. Set the mode to “On site & iframe” (self). “None” blocks geolocation, and so does “Specific origins” unless your own site is in the list.
Really Simple Security Pro Security > Settings > Security Headers > Permissions Policy. Set Geolocation to “Self”.
Headers Security Advanced & HSTS WP Settings > Headers Security Advanced & HSTS WP. In the Permissions-Policy field, change geolocation=() to geolocation=(self).

None of these block geolocation by default, so if one of them sends the header, it was changed in its settings. Other security plugins we checked, such as Wordfence, All-In-One Security, Solid Security and SiteGround Security, don’t send this header.

In .htaccess

Open .htaccess in the root of your WordPress install and find the line with Permissions-Policy. Change only the geolocation part:

# Before
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
# After
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=(self)"

In the nginx config

The same change on the add_header line. On managed hosting, ask your host to make it.

add_header Permissions-Policy "camera=(), microphone=(), geolocation=(self)" always;

At your host or CDN

Open the response header rules in your hosting panel or CDN dashboard (in Cloudflare: Rules > Transform Rules > Response Header) and edit the rule that sets Permissions-Policy. If you can’t find it, ask your host’s support to change geolocation=() to geolocation=(self).

In your theme or a code snippet

Search functions.php of your (child) theme and your code snippets plugin for Permissions-Policy, and change geolocation=() to geolocation=(self) in that line.

Confirm the fix

  1. Clear your page cache plugin and your CDN cache. A cached page keeps the old header until it is rebuilt.
  2. Repeat the check above: the Permissions-Policy header should now show geolocation=(self), or have no geolocation entry.
  3. Open Store Locator > Home in the WordPress admin. The page checks the header again each time it loads, and the alert goes away once geolocation is allowed.
  4. Open the store locator over https and click “Use my current location”. The browser should now ask for permission. Geolocation only works on https pages, so on a plain http page the button stays hidden.

Other cases

  • It works in one browser but not another. Chrome, Edge and other Chromium browsers enforce the header. Firefox and Safari ignore it (MDN), so the store locator can work there while it fails in Chrome.
  • The older Feature-Policy header. Feature-Policy: geolocation 'none' blocks geolocation the same way. Change it to geolocation 'self', or replace the header with Permissions-Policy.
  • No alert on the Home page. WP Store Locator only checks the header while “Attempt to auto-locate the user” is enabled, and it checks the first published page that contains the [wpsl] shortcode or block (or your homepage when there is none). A header that is only added to other pages, or only for logged-out visitors, can be missed. Use the steps above to check the page itself.