Signature
apply_filters( 'mam_nws_weather_for_home_screen_stack', array $locations );
Return an array of location arrays:
| Key | Type | Required | Description |
|---|---|---|---|
title |
string |
yes | Card title shown in the app (e.g. the city name). |
lat |
float |
yes | Latitude. |
lon |
float |
yes | Longitude. |
miles |
float |
no | Cache match radius for this location. Default: the Location Match Radius setting (5). |
type |
string |
no | NWS forecast variant, '' (standard) or 'hourly'. Default: the Forecast Type setting. |
When it runs
Wherever the plugin needs the developer-supplied location list: building the app payload, the 15-minute refresh job, and the Weather Data content section. Wiring this filter makes it the active location source when Weather Locations Source is Automatic (it wins over GeoDirectory) or Developer filter.
Example — fixed city list
add_filter( 'mam_nws_weather_for_home_screen_stack', function ( $locations ) {
$locations[] = array( 'title' => 'Boston', 'lat' => 42.3601, 'lon' => -71.0589 );
$locations[] = array( 'title' => 'Hartford', 'lat' => 41.7658, 'lon' => -72.6734, 'type' => 'hourly' );
return $locations;
} );
Notes
- Forecasts for these locations are cached in the
{prefix}mam_nws_weathertable for the Forecast Cache Duration (default 15 minutes); if a refresh fails, the last cached forecast is served. - US locations only (NWS coverage).
- Cards are distance-sorted when the app shares the user’s location.
Related articles
- Plugin: mam-nws-weather
- Recipe: Configure the Weather settings
- Hook:
mam_nws_get_weather_data
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-nws-weather |
| Applies to plugin version | 2.0+ |
| Category | Extending MAM Suite |
| Hook type | filter |
| Audience | PHP developer |
| Last verified | 2026-06-12 |
