How to add a store locator to a WordPress site
WordPress does not include a store locator with nearest-location search, filters and map markers. You can build one with a custom post type and mapping APIs, but a locator plugin is usually faster and safer for a live business site.
- 01Define the locator data
- 02Choose the manual route
- 03Prepare the map service
- 04Install and configure a locator plugin
- 05Add locations and test searches
- 06Use the fast way
What you need
- WordPress administrator access
- A list of locations with addresses, phone numbers and opening hours
- A map provider account if your chosen solution requires an API key
- A page where the locator will appear
Define the locator data
Decide what every location needs before you build the page. At minimum, collect the store name, complete address, latitude and longitude, phone number, opening hours, URL and category. Store the latitude and longitude as well as the written address so distance searches do not depend on geocoding every time someone uses the locator.
Also decide whether visitors need postcode or address search, category filters, current-location detection, directions and a separate page for each branch. These requirements determine whether a simple map is enough or whether you need a full locator.
Choose the manual route
The manual route uses a public custom post type for locations, custom fields for the address and coordinates, a WordPress query to load the locations, and JavaScript to render map markers. You then expose the map through a template or a shortcode; WordPress provides a Shortcode API for adding generated content to pages.
This is reasonable for a handful of fixed locations and a developer-maintained site. It becomes expensive when you need nearest-store sorting, geocoding, filters, imports, marker clustering, accessibility work or individual SEO location pages. If you register the locations as a custom post type, save the permalink changes after adding it; otherwise the branch URLs can return 404 errors.
Prepare the map service
If you build the locator around Google Maps, create the required project and enable the APIs your features use. A basic locator commonly needs the Maps JavaScript API, while address autocomplete, geocoding, directions or distance calculations may require additional services.
Restrict the key to your site and to only the APIs it needs. A common Friday-afternoon failure is a blank map caused by an incorrect referrer restriction, a disabled API or a key from a different project. Check the browser console for errors such as ApiKeyInvalid or RefererNotAllowedMapError.
Install and configure a locator plugin
For the practical route, install a store locator plugin, activate it and open its settings. Choose the map provider, set the default map centre and zoom, configure the search method, then create the locator page. Many locator plugins provide a block or shortcode that you place in a normal WordPress page; for example, WP Store Locator uses a locator block or the [wpsl] shortcode after you add the locations.
Do not assume that adding an address automatically gives you accurate coordinates. Check every marker, especially addresses with unit numbers, rural roads, shopping centres or multiple branches with similar names.
Add locations and test searches
Add each branch as its own location and fill in the customer-facing details. Use consistent categories and opening-hours formats, and add a useful description rather than repeating the address. If the plugin supports CSV import, prepare the columns first and import a small sample before loading the full list.
Test an exact address, a postcode, a town, a category filter and the nearest-location result on a phone. Check that the list and map stay in sync, the directions link opens correctly, the map is usable at narrow widths and the page still explains the locations if JavaScript is blocked.
Use the fast way
For most businesses, use a dedicated locator plugin instead of maintaining custom post types, map scripts and distance calculations yourself. Agile Store Locator is a suitable option when you need unlimited locations, nearest-store search, responsive maps, categories and individual SEO-friendly location pages. It can use MapLibre with OpenStreetMap without a map API key, or connect to providers such as Geoapify, Mapbox, MapTiler and Google Maps.
Install it, choose the map and address-search providers, add or import your locations, then place the generated locator on a page. The manual route is still fine for a small, rarely changing list, but the plugin route is quicker once visitors need search, filters, nearest results or branch pages.
Let Agile Store Locator do it
Map-based locator with unlimited locations, nearest-store search, and SEO pages; ideal for multi-location businesses over basic directories.
Sources
- developer.wordpress.org /reference/functions/register_post_type/?utm_source=openai
- developers.google.com /codelabs/maps-platform/google-maps-simple-store-locator?utm…
- developers.google.com /maps/api-security-best-practices?utm_source=openai
- en-gb.wordpress.org /plugins/wp-store-locator/?utm_source=openai
- developers.google.com /maps/third-party-platforms/wordpress/faq?hl=en&utm_source=o…
- facetwp.com /building-a-store-locator-with-facetwp/?utm_source=openai
Questions
- Can I add a store locator without a plugin?
- Yes, but you need custom development. Store each location in a custom post type or another data source, save its coordinates, query the records, load a map library and write the search and nearest-location logic. A shortcode or custom template can display the result. This is fine for a few fixed locations, but maintenance grows quickly when you add filters, imports or branch pages.
- Do I need a Google Maps API key?
- Only if your chosen map setup uses Google Maps services. Google-based locators generally need an API key, and features such as Places search, geocoding, directions or distance calculations may require additional APIs. Some plugins support alternatives such as MapLibre and OpenStreetMap, so check the provider requirements before choosing a key-based setup. Restrict any Google key to your domain and required APIs.
- Why does the map show the wrong store location?
- The usual cause is inaccurate geocoding or an incomplete address. Shopping centres, unit numbers, rural roads and similarly named streets are common trouble spots. Save and review the latitude and longitude for each branch, then test the marker manually. If a plugin imports locations, verify a small sample before importing the complete list.
- Should every store have its own page?
- Give each store its own page when local search visibility, branch-specific opening hours or detailed directions matter. A single map page is enough for a small list that rarely changes. Individual pages require consistent titles, addresses, contact details and unique descriptions; otherwise they create thin duplicate pages rather than useful location content.