Hook: mam_nws_geodirectory_categories

Signature

apply_filters( 'mam_nws_geodirectory_categories', array $categories );
Parameter Type Description
$categories array Category names parsed from the GeoDirectory Categories for Weather setting (may be empty). Return the list to use; an empty array means all listings.

Names are matched against each listing’s subcategories in the GeoDirectory app payload.


When it runs

Whenever the plugin scopes GeoDirectory listings for weather: the 15-minute refresh job, the app payload build, and the Weather Data content section. Wiring this filter also switches the GeoDirectory source on (it overrides the Weather Locations Source setting) — this preserves the pre-2.0 contract where the filter alone activated GeoDirectory weather.


Example

add_filter( 'mam_nws_geodirectory_categories', function ( $categories ) {
    return array( 'Beaches', 'Marinas' );
} );

Notes

  • Prefer the GeoDirectory Categories for Weather setting for simple cases — this filter is for dynamic scoping (or sites that predate the setting).
  • Listings outside the returned categories keep their cached nws_weather post meta; they just stop being refreshed and shown.


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
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!