If you’d like to create a button in the search bar that the user can use to automatically fill in their current location, then you first need to create a custom template.
In the template code, look for the line that outputs the search input field: line 26 in the Default and Horizontal templates, and line 37 in the Vertical template. Below that line, include the following code.
| $label = esc_attr__( 'Use my current location', 'wp-store-locator' ); | |
| $output .= "\t\t\t\t" . '<button type="button" class="wpsl-icon-direction"'; | |
| $output .= ' aria-label="' . $label . '" title="' . $label . '"></button>' . "\r\n"; |
This shows the same location icon as the button on the map. The plugin adds the icon through the wpsl-icon-direction class, and uses the same class to start the geolocation request when the button is clicked. So keep the class, even when you use your own image.

Position the Button
To place the button directly after the search input field, add the CSS below under Appearance > Customize > Additional CSS, or to the style.css in your active theme folder.
| #wpsl-search-wrap .wpsl-icon-direction { | |
| flex: 0 0 auto; | |
| align-self: center; | |
| margin: 0; | |
| margin-inline-start: 8px; | |
| padding: 4px; | |
| border: 0; | |
| background: none; | |
| color: #737373; | |
| cursor: pointer; | |
| } | |
| #wpsl-search-wrap .wpsl-icon-direction:before { | |
| font-size: 18px; | |
| } | |
| #wpsl-search-wrap .wpsl-icon-direction:hover, | |
| #wpsl-search-wrap .wpsl-icon-direction:focus-visible { | |
| color: #000; | |
| } | |
| /* Name search has no location to fill in, so hide the button. */ | |
| #wpsl-wrap.wpsl-names #wpsl-search-wrap .wpsl-input button.wpsl-icon-direction { | |
| display: none !important; | |
| } |
To make the icon smaller or bigger, change the font-size of 18px.
To use your own image instead of the icon, add this CSS as well, and change the path to the image. The path in the example is relative to the style.css in your theme folder. When you use Additional CSS, use the full URL of the image instead, for example url( 'https://yourdomain.com/wp-content/uploads/my-location.svg' ).
| #wpsl-search-wrap .wpsl-icon-direction:before { | |
| content: none; | |
| } | |
| #wpsl-search-wrap .wpsl-icon-direction { | |
| width: 24px; | |
| height: 24px; | |
| padding: 0; | |
| background: url( 'images/my-location.svg' ) no-repeat center / contain; | |
| } |
Remove the Geolocation Icon From the Map
If you enabled “Attempt to auto-locate the user” on the Search settings page, the map also shows a geolocation button. To remove that one after placing a button in the search bar, use the CSS code below. The !important is needed because the plugin shows the button again with JavaScript after a search.
| #wpsl-map-controls .wpsl-icon-direction { | |
| display: none !important; | |
| } |